/* Header móvil — diseño moderno */
@media (max-width: 991.98px) {
    :root {
        --mobile-header-h: 3.75rem;
        --mobile-header-accent: #6e4e9e;
        --mobile-header-accent-soft: rgba(110, 78, 158, 0.1);
    }

    .page-wrapper .page-header {
        height: var(--mobile-header-h);
        min-height: var(--mobile-header-h);
        padding: 0 0.75rem;
        padding-top: env(safe-area-inset-top, 0);
        gap: 0.5rem;
        background: linear-gradient(180deg, #ffffff 0%, #faf9fc 100%);
        border-bottom: 1px solid rgba(110, 78, 158, 0.1) !important;
        box-shadow: 0 4px 24px rgba(86, 61, 124, 0.08) !important;
    }

    .mobile-header-zone {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .mobile-header-brand {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .mobile-header-brand__meta {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        line-height: 1.1;
        gap: 0.1rem;
    }

    .mobile-header-brand__name {
        font-size: clamp(0.6rem, 2.6vw, 0.7rem);
        font-weight: 500;
        color: #5c5768;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        word-break: break-word;
        letter-spacing: 0;
        text-transform: none;
    }

    .mobile-header-brand__id {
        display: inline-flex;
        align-items: center;
        align-self: flex-start;
        margin-top: 0;
        padding: 0.08rem 0.4rem;
        border-radius: 999px;
        font-size: 0.6rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        color: var(--mobile-header-accent);
        background: var(--mobile-header-accent-soft);
        border: none;
        text-decoration: none;
        cursor: pointer;
        font-family: inherit;
        line-height: 1.4;
        transition: background 0.15s ease, transform 0.1s ease;
    }

    .mobile-header-brand__id.is-copied {
        background: rgba(40, 167, 69, 0.15);
        color: #1e7e34;
    }

    /* El tema oculta el header en mobile-search-on; mantener header móvil visible */
    .mobile-search-on .page-header .mobile-header-zone,
    .mobile-search-on .page-header .mobile-header-brand,
    .mobile-search-on .page-header .mobile-header-actions {
        display: flex !important;
    }

    .mobile-header-brand__id:active {
        transform: scale(0.97);
        background: rgba(110, 78, 158, 0.18);
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-shrink: 0;
        margin-left: auto !important;
    }

    .mobile-header-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 12px;
        background: var(--mobile-header-accent-soft);
        color: var(--mobile-header-accent);
        text-decoration: none;
        transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-header-btn i {
        font-size: 1.1rem;
    }

    .mobile-header-btn:active {
        transform: scale(0.94);
        background: rgba(110, 78, 158, 0.18);
    }

    .mobile-header-btn--menu {
        background: linear-gradient(135deg, rgba(110, 78, 158, 0.14) 0%, rgba(110, 78, 158, 0.08) 100%);
    }

    .mobile-header-btn--notify {
        position: relative;
    }

    /* Evitar desborde: .header-icon del tema trae line-height ~4rem */
    .page-header .header-icon.mobile-header-btn {
        line-height: 1;
        height: 40px;
        min-height: 40px;
        max-height: 40px;
    }

    .mobile-header-btn--avatar {
        flex-shrink: 0;
        padding: 0;
        background: transparent;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        max-width: 40px;
        max-height: 40px;
        line-height: 1;
        border-radius: 50%;
        overflow: hidden;
        box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(110, 78, 158, 0.35);
    }

    .mobile-header-btn--avatar::after {
        display: none !important;
    }

    .mobile-header-btn--avatar img {
        display: block;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        max-width: 40px;
        max-height: 40px;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        object-position: center;
        border-radius: 50%;
    }

    .mobile-header-btn--avatar[aria-expanded="true"] {
        box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--mobile-header-accent);
    }

    /* Ocultar estilos legacy del header en móvil */
    .page-header .header-icon:not(.mobile-header-btn) {
        display: none !important;
    }

    .page-header .hidden-lg-up .header-btn {
        display: none !important;
    }

    /* Dropdown usuario: drawer lateral en móvil (ver header-dropdown-mobile.css) */

    /* Subheader de página — título más compacto en móvil */
    .page-content .subheader {
        margin-bottom: 1rem;
    }

    .page-content .subheader .subheader-title {
        font-size: clamp(0.85rem, 3.5vw, 1rem) !important;
        line-height: 1.25 !important;
        font-weight: 500 !important;
        word-break: break-word;
    }

    .page-content .subheader .subheader-title .subheader-icon {
        font-size: 0.8em;
        margin-right: 0.35rem;
        vertical-align: 0;
    }
}

@media (min-width: 992px) {
    .page-header .header-icon[data-toggle="dropdown"]:not(.mobile-header-btn) {
        line-height: 1;
    }
}

@media (max-width: 575.98px) {
    .mobile-header-brand__name {
        -webkit-line-clamp: 1;
    }

    .page-content .subheader .subheader-title {
        font-size: 0.85rem !important;
    }
}
