/**
 * Barra superior unificada AFS — misma apariencia que index (cargar ÚLTIMO entre hojas globales).
 * Marca: icono casa + “AFS Auditoría Familiar” + subtítulo.
 */
:root {
    --afs-header-line: rgba(255, 255, 255, 0.11);
    --afs-header-text: #f2f7ff;
    --afs-header-green: #4caf50;
}

header.topbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(7, 12, 20, 0.94);
    border-bottom: 1px solid var(--afs-header-line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: "DM Sans", system-ui, sans-serif;
}

header.topbar .topbar-row {
    max-width: 1180px;
    margin: 0 auto;
    padding: 11px 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.32fr) auto;
    align-items: center;
    gap: 12px 8px;
}

header.topbar .topbar-row > * {
    min-width: 0;
}

header.topbar .topbar-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    padding-left: clamp(0.35rem, 2.2vw, 1.35rem);
    gap: 4px 10px;
    font-size: 0.875rem;
    row-gap: 6px;
}

header.topbar .topbar-nav a {
    color: #c5d4e8 !important;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.38rem 0.7rem;
    border-radius: 8px;
    border: 1px solid transparent;
    box-sizing: border-box;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

header.topbar .topbar-nav a:hover {
    color: var(--afs-header-green) !important;
    background: rgba(76, 175, 80, 0.1);
}

header.topbar .topbar-nav a[aria-current="page"],
header.topbar .topbar-nav a.topbar-nav__active {
    color: #f0f6ff !important;
    background: rgba(76, 175, 80, 0.22) !important;
    border-color: rgba(76, 175, 80, 0.45) !important;
    box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.12);
}

header.topbar .topbar-nav a[aria-current="page"]:hover,
header.topbar .topbar-nav a.topbar-nav__active:hover {
    color: #fff !important;
    background: rgba(76, 175, 80, 0.28) !important;
}

header.topbar .topbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

header.topbar .topbar-tools select {
    background-color: #1e2e3e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239fb4d0' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    color: white;
    border: 1px solid var(--afs-header-green);
    border-radius: 999px;
    padding: 0 30px 0 12px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: "DM Sans", system-ui, sans-serif;
    height: 2.375rem;
    min-height: 2.375rem;
    line-height: 1.2;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Marca: casa + bloque de texto (como referencia clásica del sitio) */
.brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--afs-header-text);
    font-family: "DM Sans", system-ui, sans-serif;
    max-width: 100%;
    min-width: 0;
}

.brand-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    color: var(--afs-header-green);
    font-size: 1.22rem;
}

.brand-icon i {
    line-height: 1;
}

/* El icono no debe heredar DM Sans (rompe el glifo de Font Awesome) */
header.topbar .brand-icon .fas,
header.topbar .brand-icon .fa-solid {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}

.brand-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3em;
    font-size: 1.08rem;
    line-height: 1.28;
    max-width: 100%;
    font-weight: 700;
}

.brand-mark {
    color: var(--afs-header-green);
    font-weight: 800;
}

.brand-name {
    font-weight: 700;
    color: var(--afs-header-text);
}

/* Subtítulo legible, sin mayúsculas forzadas */
.brand-tag {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(186, 201, 218, 0.92);
    letter-spacing: 0.02em;
    text-transform: none;
    line-height: 1.35;
    max-width: min(100%, 26rem);
}

@media (max-width: 720px) {
    header.topbar .topbar-row {
        grid-template-columns: 1fr;
        justify-items: stretch;
        padding: 10px 14px;
    }

    header.topbar .topbar-nav {
        justify-content: flex-start;
    }

    header.topbar .topbar-tools {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    header.topbar .brand-icon {
        width: 1.95rem;
        height: 1.95rem;
        font-size: 1.08rem;
    }

    header.topbar .brand-line {
        font-size: 1.02rem;
    }

    header.topbar .brand-tag {
        font-size: 0.68rem;
    }
}

/* Si otro CSS global (p. ej. body Inter / apariencia-maestra) pisa la barra */
header.topbar .topbar-nav a {
    font-family: "DM Sans", system-ui, sans-serif;
}

header.topbar .topbar-tools select {
    font-family: "DM Sans", system-ui, sans-serif;
}
