/* ===== Header global — barra blanca, logo a color (sin frameworks) ===== */
:root {
    --hd-green: #51a121;
    --hd-green-dark: #3d7114;
    --hd-green-soft: #f2f7ec;
    --hd-text: #3f4652;
    --hd-text-strong: #1f2937;
    --hd-text-muted: #6b7280;
    --hd-border: #e9ece8;
    --hd-h: 86px;
    --hd-h-scrolled: 74px;
}

.PWEB_HD {
    position: sticky;
    top: 0;
    /* Sobre el contenido, bajo los modales de la app (z-index: 50). */
    z-index: 45;
    background: #51a121;
    color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 3px 14px rgba(23, 58, 10, 0.16);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

    .PWEB_HD.is-scrolled {
        border-bottom-color: rgba(0, 0, 0, 0.14);
        box-shadow: 0 8px 26px rgba(23, 58, 10, 0.26);
    }

.PWEB_HD_inner {
    width: min(1280px, calc(100vw - 2.5rem));
    margin: 0 auto;
    height: var(--hd-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: height 0.25s ease;
}

.PWEB_HD.is-scrolled .PWEB_HD_inner {
    height: var(--hd-h-scrolled);
}

/* ---- Marca ---- */
.PWEB_HD_brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.PWEB_HD_logo {
    height: 58px;
    width: auto;
    display: block;
    transition: height 0.25s ease;
}

.PWEB_HD.is-scrolled .PWEB_HD_logo {
    height: 50px;
}

/* ---- Navegación desktop ---- */
.PWEB_HD_nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex: 1;
    justify-content: center;
}

.PWEB_HD_navItem {
    position: relative;
}

.PWEB_HD_navLink {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.55rem;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease;
}

    .PWEB_HD_navLink::after {
        content: "";
        position: absolute;
        left: 0.55rem;
        right: 0.55rem;
        bottom: 0;
        height: 2px;
        border-radius: 2px;
        background: #ffffff;
        transform: scaleX(0);
        transition: transform 0.18s ease;
    }

    .PWEB_HD_navLink:hover,
    .PWEB_HD_navLink[aria-expanded="true"] {
        color: #ffffff;
    }

        .PWEB_HD_navLink:hover::after,
        .PWEB_HD_navLink[aria-expanded="true"]::after {
            transform: scaleX(1);
        }

    .PWEB_HD_navLink.is-active {
        color: #ffffff;
        font-weight: 600;
    }

        .PWEB_HD_navLink.is-active::after {
            transform: scaleX(1);
        }

.PWEB_HD_caret {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.PWEB_HD_navLink[aria-expanded="true"] .PWEB_HD_caret {
    transform: rotate(180deg);
}

/* ---- Menú desplegable ---- */
.PWEB_HD_menu {
    position: absolute;
    top: calc(100% + 14px);
    left: 0;
    min-width: 268px;
    max-width: calc(100vw - 2rem);
    padding: 0.4rem;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 20;
}

    .PWEB_HD_menu.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .PWEB_HD_menu--right {
        left: auto;
        right: 0;
    }

    .PWEB_HD_menu--2col {
        min-width: 480px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.1rem;
    }

.PWEB_HD_menuLink {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    border-radius: 9px;
    text-decoration: none;
    color: var(--hd-text-strong);
    transition: background-color 0.12s ease;
}

    .PWEB_HD_menuLink:hover {
        background: var(--hd-green-soft);
    }

.PWEB_HD_menuIcon {
    flex-shrink: 0;
    width: 1.5rem;
    margin-top: 0.1rem;
    text-align: center;
    color: var(--hd-green);
    font-size: 0.9rem;
}

.PWEB_HD_menuTitle {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hd-text-strong);
}

.PWEB_HD_menuDesc {
    display: block;
    font-size: 0.74rem;
    line-height: 1.35;
    color: var(--hd-text-muted);
    margin-top: 1px;
}

/* ---- Área de sesión ---- */
.PWEB_HD_auth {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.PWEB_HD_ghostLink {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

    .PWEB_HD_ghostLink:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.14);
    }

.PWEB_HD_loginBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #ffffff;
    color: var(--hd-green-dark);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .PWEB_HD_loginBtn:hover {
        background: var(--hd-green-soft);
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
    }

/* Usuario logueado */
.PWEB_HD_userBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-family: inherit;
    cursor: pointer;
    padding: 0.3rem 0.6rem 0.3rem 0.35rem;
    border-radius: 999px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .PWEB_HD_userBtn:hover,
    .PWEB_HD_userBtn[aria-expanded="true"] {
        background: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.55);
    }

.PWEB_HD_avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #ffffff;
    color: var(--hd-green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.PWEB_HD_userMeta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    max-width: 150px;
}

    .PWEB_HD_userMeta b {
        font-size: 0.8rem;
        font-weight: 600;
        color: #ffffff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    .PWEB_HD_userMeta span {
        font-size: 0.68rem;
        color: rgba(255, 255, 255, 0.78);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

.PWEB_HD_userMenuLink {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--hd-text);
    font-size: 0.85rem;
    transition: background-color 0.12s ease;
}

    .PWEB_HD_userMenuLink:hover {
        background: var(--hd-green-soft);
    }

    .PWEB_HD_userMenuLink i {
        width: 1.1rem;
        text-align: center;
        color: #9ca3af;
    }

    .PWEB_HD_userMenuLink--danger {
        color: #dc2626;
    }

        .PWEB_HD_userMenuLink--danger:hover {
            background: #fef2f2;
        }

        .PWEB_HD_userMenuLink--danger i {
            color: #dc2626;
        }

.PWEB_HD_menuSep {
    height: 1px;
    background: var(--hd-border);
    margin: 0.3rem 0.4rem;
}

/* ---- Botón hamburguesa (3 líneas que se transforman en X) ---- */
.PWEB_HD_burger {
    display: none;
    width: 2.7rem;
    height: 2.7rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 11px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .PWEB_HD_burger:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.5);
    }

.PWEB_HD_burgerBox {
    position: relative;
    width: 20px;
    height: 14px;
    flex-shrink: 0;
}

    .PWEB_HD_burgerBox > span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background: #ffffff;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, top 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    }

        .PWEB_HD_burgerBox > span:nth-child(1) { top: 0; }
        .PWEB_HD_burgerBox > span:nth-child(2) { top: 6px; }
        .PWEB_HD_burgerBox > span:nth-child(3) { top: 12px; }

.PWEB_HD_burger[aria-expanded="true"] .PWEB_HD_burgerBox > span:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
}

.PWEB_HD_burger[aria-expanded="true"] .PWEB_HD_burgerBox > span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.3);
}

.PWEB_HD_burger[aria-expanded="true"] .PWEB_HD_burgerBox > span:nth-child(3) {
    top: 6px;
    transform: rotate(-45deg);
}

/* ---- Panel móvil (superficie clara, acentos verdes) ---- */
.PWEB_HD_mobile {
    position: fixed;
    top: var(--hd-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 40;
    color: var(--hd-text-strong);
}

.PWEB_HD.is-scrolled .PWEB_HD_mobile {
    top: var(--hd-h-scrolled);
}

    .PWEB_HD_mobile.is-open {
        transform: translateX(0);
    }

/* Barra superior del panel */
.PWEB_HD_mHead {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--hd-border);
}

.PWEB_HD_mHeadTitle {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hd-text-muted);
}

.PWEB_HD_mClose {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    background: #ffffff;
    border: 1px solid var(--hd-border);
    border-radius: 10px;
    color: var(--hd-text);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

    .PWEB_HD_mClose:hover {
        background: var(--hd-green-soft);
        border-color: var(--hd-green);
        color: var(--hd-green-dark);
    }

.PWEB_HD_mBody {
    padding: 1.1rem 1.1rem 2.5rem;
}

/* Sesión — sin usuario */
.PWEB_HD_mAuth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 1.15rem;
}

.PWEB_HD_mAuthBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    padding: 0.72rem;
    border-radius: 11px;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

    .PWEB_HD_mAuthBtn:first-child {
        background: var(--hd-green);
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(81, 161, 33, 0.28);
    }

    .PWEB_HD_mAuthBtn:last-child {
        background: var(--hd-green-soft);
        color: var(--hd-green-dark);
        border-color: #dcebcf;
    }

    .PWEB_HD_mAuthBtn:active {
        transform: translateY(1px);
    }

/* Sesión — con usuario */
.PWEB_HD_mUserCard {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--hd-green-soft);
    border: 1px solid #dcebcf;
    border-radius: 14px;
    padding: 0.85rem;
    margin-bottom: 1.15rem;
    text-decoration: none;
}

    .PWEB_HD_mUserCard .PWEB_HD_avatar {
        width: 2.5rem;
        height: 2.5rem;
        background: var(--hd-green);
        color: #ffffff;
        font-size: 0.95rem;
    }

    .PWEB_HD_mUserCard b {
        display: block;
        color: var(--hd-text-strong);
        font-size: 0.92rem;
        line-height: 1.25;
    }

    .PWEB_HD_mUserCard span > span,
    .PWEB_HD_mUserCard > span span {
        font-size: 0.76rem;
        color: var(--hd-text-muted);
    }

/* Enlaces principales */
.PWEB_HD_mLink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hd-border);
    color: var(--hd-text-strong);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    padding: 0.9rem 0.4rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.14s ease;
}

    .PWEB_HD_mLink:last-child {
        border-bottom: 0;
    }

    .PWEB_HD_mLink:hover,
    .PWEB_HD_mLink[aria-expanded="true"] {
        background: var(--hd-green-soft);
    }

    .PWEB_HD_mLink > span {
        display: inline-flex;
        align-items: center;
        gap: 0.85rem;
        min-width: 0;
    }

        .PWEB_HD_mLink > span > i:first-child {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            width: 1.95rem;
            height: 1.95rem;
            border-radius: 9px;
            background: var(--hd-green-soft);
            color: var(--hd-green);
            font-size: 0.85rem;
            transition: background-color 0.14s ease, color 0.14s ease;
        }

    .PWEB_HD_mLink[aria-expanded="true"] > span > i:first-child {
        background: var(--hd-green);
        color: #ffffff;
    }

    .PWEB_HD_mLink i.PWEB_HD_mCaret {
        flex-shrink: 0;
        color: var(--hd-text-muted);
        font-size: 0.72rem;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .PWEB_HD_mLink[aria-expanded="true"] i.PWEB_HD_mCaret {
        transform: rotate(180deg);
        color: var(--hd-green);
    }

.PWEB_HD_mLink--danger {
    color: #dc2626;
}

    .PWEB_HD_mLink--danger > span > i:first-child {
        background: #fef2f2;
        color: #dc2626;
    }

    .PWEB_HD_mLink--danger:hover {
        background: #fef2f2;
    }

/* Submenús (acordeón) */
.PWEB_HD_mSub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

    .PWEB_HD_mSub.is-open {
        grid-template-rows: 1fr;
    }

    .PWEB_HD_mSub > div {
        overflow: hidden;
    }

    .PWEB_HD_mSub a {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        margin: 0.15rem 0 0.15rem 1.35rem;
        padding: 0.62rem 0.6rem 0.62rem 0.9rem;
        border-left: 2px solid var(--hd-border);
        border-radius: 0 8px 8px 0;
        color: var(--hd-text);
        text-decoration: none;
        font-size: 0.87rem;
        font-weight: 500;
        transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
    }

        .PWEB_HD_mSub a::before {
            content: "";
            flex-shrink: 0;
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: #cbd5c0;
            transition: background-color 0.14s ease;
        }

        .PWEB_HD_mSub a:hover {
            background: var(--hd-green-soft);
            border-left-color: var(--hd-green);
            color: var(--hd-green-dark);
        }

            .PWEB_HD_mSub a:hover::before {
                background: var(--hd-green);
            }

    .PWEB_HD_mSub.is-open > div {
        padding-bottom: 0.4rem;
    }

/* ---- Breakpoints ---- */
@media (max-width: 1150px) {
    .PWEB_HD_nav,
    .PWEB_HD_auth {
        display: none;
    }

    .PWEB_HD_burger {
        display: inline-flex;
    }
}

@media (min-width: 1151px) {
    .PWEB_HD_mobile {
        display: none;
    }
}

@media (max-width: 480px) {
    .PWEB_HD_logo {
        height: 42px;
    }

    .PWEB_HD.is-scrolled .PWEB_HD_logo {
        height: 36px;
    }

    .PWEB_HD_mBody {
        padding: 1rem 0.9rem 2.5rem;
    }

    .PWEB_HD_mAuth {
        grid-template-columns: 1fr;
    }
}
