.anaccim-acervo {
    --aa-border: #e4e7ec;
    --aa-text: #1d2939;
    --aa-muted: #667085;
    --aa-bg: #ffffff;
    --aa-soft: #f8fafc;
    --aa-accent: #173f68;
    --aa-radius: 16px;
    color: var(--aa-text);
    font-family: inherit;
    margin: 24px 0;
}

.anaccim-acervo * {
    box-sizing: border-box;
}

.aa-header {
    margin-bottom: 22px;
}

.aa-header h2 {
    margin: 0 0 16px;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    line-height: 1.15;
}

.aa-search-wrap {
    position: relative;
    max-width: 760px;
}

.aa-search {
    width: 100%;
    min-height: 52px;
    padding: 12px 18px 12px 46px;
    border: 1px solid var(--aa-border);
    border-radius: 999px;
    background: var(--aa-bg);
    color: var(--aa-text);
    font-size: 16px;
    outline: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.aa-search:focus {
    border-color: var(--aa-accent);
    box-shadow: 0 0 0 3px rgba(23, 63, 104, .12);
}

.aa-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 23px;
    color: var(--aa-muted);
    pointer-events: none;
}

.aa-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--aa-border);
    border-radius: 14px;
    box-shadow: 0 14px 35px rgba(16, 24, 40, .14);
    overflow: hidden;
}

.aa-suggestions button {
    display: block;
    width: 100%;
    padding: 11px 15px;
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    background: #fff;
    text-align: left;
    color: var(--aa-text);
    cursor: pointer;
}

.aa-suggestions button:hover,
.aa-suggestions button:focus {
    background: var(--aa-soft);
}

.aa-summary {
    margin: 10px 4px 0;
    color: var(--aa-muted);
    font-size: 14px;
}

.aa-grid {
    display: grid;
    gap: 14px;
}

.aa-card {
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    background: var(--aa-bg);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.aa-card-heading {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border: 0;
    background: transparent;
    color: var(--aa-text);
    text-align: left;
    cursor: pointer;
}

.aa-card-heading > span:first-child {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    align-items: center;
    width: 100%;
}

.aa-card-heading strong {
    font-size: 17px;
    line-height: 1.35;
}

.aa-card-heading small {
    grid-column: 2;
    margin-top: 3px;
    color: var(--aa-muted);
    font-size: 13px;
}

.aa-folder {
    grid-row: 1 / span 2;
    font-size: 20px;
    color: var(--aa-accent);
}

.aa-chevron {
    font-size: 22px;
    transition: transform .2s ease;
}

.aa-card.is-open .aa-chevron {
    transform: rotate(180deg);
}

.aa-files {
    border-top: 1px solid var(--aa-border);
    background: var(--aa-soft);
    padding: 5px 18px;
}

.aa-file {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 2px;
    border-bottom: 1px solid var(--aa-border);
}

.aa-file:last-child {
    border-bottom: 0;
}

.aa-file-icon {
    flex: 0 0 auto;
    min-width: 36px;
    padding: 5px 4px;
    border-radius: 7px;
    background: #b42318;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    letter-spacing: .03em;
}

.aa-file-main {
    min-width: 0;
}

.aa-file-main a {
    color: var(--aa-accent);
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.aa-file-main a:hover,
.aa-file-main a:focus {
    text-decoration: underline;
}

.aa-file-main small {
    display: block;
    margin-top: 3px;
    color: var(--aa-muted);
}

.aa-empty,
.aa-no-results,
.aa-lock-card {
    padding: 28px;
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    background: var(--aa-soft);
    text-align: center;
}

.aa-lock-card {
    max-width: 620px;
    margin: 0 auto;
}

.aa-lock-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.aa-button {
    display: inline-block;
    margin-top: 10px;
    padding: 11px 19px;
    border-radius: 999px;
    background: var(--aa-accent);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .aa-card-heading {
        padding: 15px;
    }

    .aa-files {
        padding: 4px 13px;
    }

    .aa-file {
        align-items: flex-start;
    }
}


/* Compatibilidad con temas que fuerzan enlaces blancos */
.anaccim-acervo .aa-file-main a,
.anaccim-acervo .aa-file-main a:link,
.anaccim-acervo .aa-file-main a:visited {
    color: var(--aa-accent) !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-shadow: none !important;
    -webkit-text-fill-color: var(--aa-accent) !important;
}

.anaccim-acervo .aa-file-main a:hover,
.anaccim-acervo .aa-file-main a:focus {
    color: #0f2f50 !important;
    -webkit-text-fill-color: #0f2f50 !important;
}

.anaccim-acervo .aa-file-main small {
    color: var(--aa-muted) !important;
    opacity: 1 !important;
}


/* Mejoras visuales v1.1 */
.anaccim-acervo mark {
    padding: 0 .08em;
    border-radius: 3px;
    background: #fff0a8;
    color: inherit;
}

.anaccim-acervo .aa-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.anaccim-acervo .aa-card:hover {
    transform: translateY(-1px);
    border-color: #cfd6df;
    box-shadow: 0 7px 18px rgba(16, 24, 40, .07);
}

.anaccim-acervo .aa-files:not([hidden]) {
    animation: aaReveal .2s ease-out;
    transform-origin: top;
}

@keyframes aaReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anaccim-acervo .aa-file-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 44px;
    min-width: 38px;
    padding: 0;
    border-radius: 6px;
    background: #b42318;
    box-shadow: inset 0 -7px 0 rgba(0,0,0,.08);
}

.anaccim-acervo .aa-file-icon span:last-child {
    position: relative;
    z-index: 2;
    margin-top: 10px;
    font-size: 9px;
    line-height: 1;
}

.anaccim-acervo .aa-file-sheet {
    position: absolute;
    top: 5px;
    left: 9px;
    width: 20px;
    height: 24px;
    border-radius: 2px;
    background: rgba(255,255,255,.96);
}

.anaccim-acervo .aa-file-sheet::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    border-style: solid;
    border-width: 0 0 6px 6px;
    border-color: transparent transparent #efb6b1 transparent;
}

@media (prefers-reduced-motion: reduce) {
    .anaccim-acervo .aa-card,
    .anaccim-acervo .aa-files:not([hidden]) {
        transition: none;
        animation: none;
    }
}


/* Biblioteca privada: resultados tipo buscador v1.4 */
.anaccim-acervo--search-page {
    max-width: 980px;
}

.aa-private-header {
    margin-bottom: 28px;
}

.aa-private-search-form .aa-search-wrap {
    max-width: 860px;
    display: flex;
}

.aa-private-search-form .aa-search {
    padding-right: 118px;
}

.aa-search-button {
    position: absolute;
    top: 5px;
    right: 5px;
    min-height: 42px;
    padding: 0 21px;
    border: 0;
    border-radius: 999px;
    background: var(--aa-accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.aa-search-button:hover,
.aa-search-button:focus {
    background: #0f2f50;
}

.aa-library-count {
    margin: 10px 4px 0;
    color: var(--aa-muted);
    font-size: 15px;
}

.aa-search-status {
    min-height: 26px;
    margin-bottom: 15px;
    color: var(--aa-muted);
    font-size: 14px;
}

.aa-google-results {
    max-width: 860px;
}

.aa-search-result {
    padding: 18px 4px 20px;
    border-bottom: 1px solid var(--aa-border);
}

.aa-result-type {
    margin-bottom: 4px;
    color: var(--aa-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.aa-search-result h3 {
    margin: 0 0 5px;
    font-size: clamp(1.12rem, 2vw, 1.35rem);
    line-height: 1.35;
}

.anaccim-acervo .aa-search-result h3 a,
.anaccim-acervo .aa-search-result h3 a:link,
.anaccim-acervo .aa-search-result h3 a:visited {
    color: var(--aa-accent) !important;
    -webkit-text-fill-color: var(--aa-accent) !important;
    text-decoration: none;
}

.anaccim-acervo .aa-search-result h3 a:hover,
.anaccim-acervo .aa-search-result h3 a:focus {
    text-decoration: underline;
}

.aa-search-result p {
    margin: 0;
    color: var(--aa-muted);
    font-size: 14px;
}

.aa-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 24px;
}

.aa-pagination button {
    min-width: 38px;
    min-height: 38px;
    padding: 6px 11px;
    border: 1px solid var(--aa-border);
    border-radius: 9px;
    background: #fff;
    color: var(--aa-accent);
    cursor: pointer;
}

.aa-pagination button[aria-current="page"] {
    background: var(--aa-accent);
    color: #fff;
    border-color: var(--aa-accent);
}

.aa-pagination button:disabled {
    opacity: .45;
    cursor: default;
}

.aa-results-loading {
    display: flex;
    gap: 6px;
    padding: 22px 4px;
}

.aa-results-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aa-accent);
    animation: aaPulse .9s infinite alternate;
}

.aa-results-loading span:nth-child(2) {
    animation-delay: .15s;
}

.aa-results-loading span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes aaPulse {
    to {
        opacity: .25;
        transform: translateY(-3px);
    }
}

@media (max-width: 640px) {
    .aa-private-search-form .aa-search {
        padding-right: 48px;
    }

    .aa-search-button {
        position: static;
        margin-top: 10px;
        width: 100%;
    }

    .aa-private-search-form .aa-search-wrap {
        display: block;
    }

    .aa-pagination button:first-child,
    .aa-pagination button:last-child {
        flex: 1 1 auto;
    }
}



/* Navegación compartida ANACCIM */
.anaccim-acervo .anaccim-section-nav{display:flex;gap:8px;margin:0 0 16px;padding:6px;border:1px solid #dfe5ec;border-radius:14px;background:#fff;box-shadow:0 6px 18px rgba(16,38,65,.06)}
.anaccim-acervo .anaccim-section-nav a{flex:1;padding:12px 18px;border-radius:10px;color:#123f69;font-weight:800;text-align:center;text-decoration:none}
.anaccim-acervo .anaccim-section-nav a:hover{background:#eef4f9}
.anaccim-acervo .anaccim-section-nav a.is-active{background:#0b2e52;color:#fff}
.aa-cronista-link{display:inline-block;margin-top:7px;color:#123f69!important;font-size:12px;font-weight:800;text-decoration:none}
.aa-cronista-link:hover{text-decoration:underline}
@media(max-width:650px){.anaccim-acervo .anaccim-section-nav{flex-direction:column}}

/* Navegación unificada 2.0 */
.anaccim-acervo .anaccim-section-nav{border-color:#123f69!important;background:#fff!important}
.anaccim-acervo .anaccim-section-nav a{border:1px solid #123f69!important;background:#fff!important;color:#123f69!important;transition:.2s ease}
.anaccim-acervo .anaccim-section-nav a:hover{background:#eef4f9!important;color:#123f69!important}
.anaccim-acervo .anaccim-section-nav a.is-active{background:#123f69!important;color:#fff!important}

/* Acceso institucional a la Biblioteca privada v2.2 */
.anaccim-acervo--locked {
    --aa-accent: #173f68;
    display: flex;
    justify-content: center;
    padding: 18px 0;
}

.anaccim-acervo--locked .aa-lock-card {
    width: min(100%, 520px);
    padding: clamp(24px, 5vw, 42px);
    border: 1px solid var(--aa-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(16, 24, 40, .09);
    text-align: left;
}

.aa-login-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 130px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.anaccim-acervo--locked h2 {
    margin: 0 0 10px;
    text-align: center;
    font-size: clamp(1.55rem, 4vw, 2rem);
    line-height: 1.2;
}

.aa-login-intro,
.aa-login-help {
    margin: 0;
    color: var(--aa-muted);
    text-align: center;
}

.aa-login-help { margin-top: 7px; }

.aa-login-error {
    margin: 20px 0 0;
    padding: 12px 14px;
    border: 1px solid #f3b5b5;
    border-radius: 10px;
    background: #fff4f4;
    color: #9f1d1d;
    font-weight: 600;
}

.aa-login-form { margin-top: 24px; }
.aa-login-form p { margin: 0 0 16px; }

.aa-login-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--aa-text);
    font-weight: 700;
}

.aa-login-form input[type="text"],
.aa-login-form input[type="password"] {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #cfd6df;
    border-radius: 10px;
    background: #fff;
    color: var(--aa-text);
    font: inherit;
    outline: none;
}

.aa-login-form input[type="text"]:focus,
.aa-login-form input[type="password"]:focus {
    border-color: var(--aa-accent);
    box-shadow: 0 0 0 3px rgba(23, 63, 104, .13);
}

.aa-login-form .aa-login-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--aa-muted);
    font-weight: 500;
}

.aa-login-submit {
    width: 100%;
    min-height: 48px;
    padding: 11px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--aa-accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.aa-login-submit:hover,
.aa-login-submit:focus {
    background: #0f2f50;
    transform: translateY(-1px);
}

.aa-lost-password {
    margin: 16px 0 0;
    text-align: center;
}

.aa-lost-password a {
    color: var(--aa-accent);
    font-weight: 600;
    text-decoration: none;
}

.aa-lost-password a:hover,
.aa-lost-password a:focus { text-decoration: underline; }

.aa-login-note {
    margin: 24px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--aa-border);
    color: var(--aa-muted);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

@media (max-width: 560px) {
    .anaccim-acervo--locked { padding: 4px 0; }
    .anaccim-acervo--locked .aa-lock-card {
        padding: 24px 18px;
        border-radius: 12px;
    }
    .aa-login-logo { max-width: 130px; }
}
