/* mod_documentos_historicos 1.2.1 — estilos encapsulados, basados en diseños suministrados */
.dh-module {
    --dh-magenta: #b6004c;
    --dh-blue: #2c43b5;
    --dh-blue-hover: #0f1d63;
    --dh-visited: #520022;
    --dh-border: #d3dbea;
    --dh-text: #23314d;
    --dh-muted: #5e687b;
    --dh-soft: #f5f7fb;
    font-family: "Nunito Sans", Arial, sans-serif;
    color: var(--dh-text);
    font-size: 14px;
    line-height: 1.35;
    width: 100%;
    box-sizing: border-box;
}

.dh-module * {
    box-sizing: border-box;
}

.dh-help {
    margin: 0 0 14px;
    color: var(--dh-muted);
}

.dh-filters {
    display: flex;
    align-items: flex-end;
    gap: 12px 14px;
    flex-wrap: wrap;
    margin: 0 0 20px;
    padding: 0;
    background: transparent;
}

.dh-filter {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 132px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #25314b;
}

.dh-filter--sort {
    min-width: 200px;
    margin-left: auto;
}

.dh-filter--search {
    min-width: 220px;
}

.dh-filter input,
.dh-filter select {
    width: 100%;
    height: 38px;
    border: 1px solid #aebbd3;
    border-radius: 5px;
    background: #fff;
    color: var(--color-secundario-700);
    padding: 0 32px 0 11px;
    font: 14px;
    outline: none;
}

.dh-filter input {
    padding: 0 10px;
}

.dh-filter input:focus,
.dh-filter select:focus {
    border-color: var(--dh-blue);
    box-shadow: 0 0 0 2px rgba(44, 67, 181, .13);
}

.dh-select-wrap {
    position: relative;
    display: block;
}

.dh-select-wrap select {
    appearance: auto;
}

.dh-select-wrap select::picker-icon{
    color: red;
}

/* Contenedor del selector */
.dh-select-wrap {
    position: relative;
    display: block;
}

/* Selector */
.dh-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    width: 100%;
    padding-right: 36px;
}

/* Flecha personalizada */
.dh-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;

    width: 8px;
    height: 8px;

    border-right: 1.5px solid var(--color-secundario-700);
    border-bottom: 1.5px solid var(--color-secundario-700);

    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}


.dh-select-icon {
    display: none;
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #40516f;
    pointer-events: none;
    z-index: 1;
}

.dh-select-icon+select {
    /* padding-left: 27px; */
}

.dh-search-button {
    height: 38px;
    min-width: 86px;
    border: 0;
    border-radius: 22px;
    background: var(--dh-magenta);
    color: #fff;
    padding: 0 22px;
    font: 1rem;
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}

.dh-search-button:hover,
.dh-search-button:focus-visible {
    background: #8e003d;
}

.dh-search-button:active {
    transform: translateY(1px);
}

.dh-result-message {
    padding: 10px 0 30px 0;
    font-size: 1rem !important;
}

.dh-results[aria-busy="true"] {
    opacity: .6;
    pointer-events: none;
}

.dh-period {
    padding: 0;
    margin: 0 0 24px;
    border-bottom: 1px solid var(--dh-border);
}

.dh-period__heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
}

.dh-period__title {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--color-principal-500) !important;
    font: 700 1rem/1.25 "Nunito Sans", Arial, sans-serif !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.dh-badge-latest {
    display: inline-block;
    border: 1px solid #b7c2d7;
    border-radius: 3px;
    background: #f4f6fa;
    color: #69758c;
    padding: 2px 7px;
    font-size: 0.875rem;
    line-height: 1.2;
}

.dh-documents {
    display: flex;
    flex-direction: column;
    padding-bottom: 7px;
}

.dh-document {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px minmax(0, 1fr);
    align-items: center;
    font-size: 0.9rem;
    color: var(--dh-muted);
    margin-bottom: 10px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.dh-document__main {
    min-width: 0;
}

.dh-document__link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--dh-blue) !important;
    text-decoration: none !important;
    line-height: 1.25;
    max-width: 100%;
    min-width: 0;
}

.dh-document__link:hover,
.dh-document__link:focus-visible {
    color: var(--dh-blue-hover) !important;
    text-decoration: underline !important;
}

.dh-document__link.is-visited {
    color: var(--dh-visited) !important;
}

.dh-document__link span:last-child {
    overflow-wrap: anywhere;
}

.dh-document__link span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dh-file-icon {
    display: block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.dh-file-fallback {
    color: var(--dh-blue);
    font-size: 13px;
}

.dh-document__size {
    font-size: 0.9rem;
    padding: 0 10px;
    border-right: 1px solid var(--dh-border);
    white-space: nowrap;
    color: #5d6678;
    display: flex;
    justify-content: end;
}

.dh-document__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-left: 10px;
    white-space: normal;
}

.dh-document__dates {
    white-space: nowrap;
}

.dh-note-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--dh-blue);
    font: 400 0.875rem;/1.3 "Nunito Sans", Arial, sans-serif;
    cursor: pointer;
    white-space: nowrap;
}

.dh-note-button:hover,
.dh-note-button:focus-visible {
    color: var(--dh-blue-hover);
    text-decoration: underline;
}

.dh-empty {
    font-size: 13px;
    color: var(--dh-muted);
    padding: 12px 0;
}

.dh-pagination-wrap {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    margin: 22px 0 0;
    font-size: 11px;
    color: #525d70;
}

.dh-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dh-per-page label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.dh-per-page-select {
    height: 36px;
    min-width: 122px;
    border: 1px solid #aebbd3;
    border-radius: 5px;
    background: #fff;
    color: #536078;
    padding: 0 10px;
    font-size: 11px;
}

.dh-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.dh-pagination button {
    width: 31px;
    height: 31px;
    border: 1px solid #aebbd3;
    border-radius: 4px;
    background: #fff;
    color: var(--dh-magenta);
    font: 500 11px/1 "Nunito Sans", Arial, sans-serif;
    cursor: pointer;
}

.dh-pagination button:hover:not(:disabled),
.dh-pagination button:focus-visible {
    border-color: var(--dh-magenta);
}

.dh-pagination button.is-active {
    background: var(--dh-magenta);
    border-color: var(--dh-magenta);
    color: #fff;
}

.dh-pagination button:disabled {
    background: #eef1f6;
    color: #9ba5b8;
    cursor: not-allowed;
}

.dh-page-ellipsis {
    min-width: 26px;
    text-align: center;
    color: #6f7888;
}

.dh-pagination-summary {
    text-align: right;
    white-space: nowrap;
}

.dh-note-dialog {
    width: min(620px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    color: var(--dh-text);
}

.dh-note-dialog::backdrop {
    background: rgba(15, 29, 63, .52);
}

.dh-dialog-inner {
    position: relative;
    padding: 28px 30px 26px;
}

.dh-dialog-inner h3 {
    margin: 0 36px 14px 0;
    color: var(--dh-magenta);
    font: 700 18px/1.3 "Nunito Sans", Arial, sans-serif;
}

.dh-dialog-inner [data-dh-dialog-text] {
    white-space: pre-line;
    font-size: 1rem;
    line-height: 1.55;
}

.dh-dialog-close {
    position: absolute;
    right: 13px;
    top: 10px;
    border: 0;
    background: transparent;
    color: #44506a;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

@media(max-width:900px) {
    .dh-filter--sort {
        margin-left: 0;
    }

    .dh-document {
        grid-template-columns: minmax(180px, 1fr) 72px minmax(220px, 1.2fr);
    }

    .dh-pagination-wrap {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .dh-pagination-summary {
        text-align: center;
    }
}

@media(max-width:640px) {
    .dh-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .dh-filter,
    .dh-filter--sort,
    .dh-filter--search {
        min-width: 0;
        width: 100%;
    }

    .dh-filter--sort {
        grid-column: 1/-1;
    }

    .dh-search-button {
        width: 100%;
        min-width: 0;
    }

    .dh-document {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 3px 8px;
        padding: 5px 0;
    }

    .dh-document__main {
        grid-column: 1;
    }

    .dh-document__size {
        grid-column: 2;
        border-right: 0;
        padding: 0;
    }

    .dh-document__meta {
        grid-column: 1/-1;
        padding-left: 21px;
        flex-wrap: wrap;
    }

    .dh-document__dates {
        white-space: normal;
    }

    .dh-period__heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .dh-pagination {
        flex-wrap: wrap;
    }

    .dh-per-page {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dh-dialog-inner {
        padding: 24px 20px;
    }
}

@media(max-width:420px) {
    .dh-filters {
        grid-template-columns: 1fr;
    }

    .dh-filter--sort {
        grid-column: auto;
    }

    .dh-search-button {
        order: 10;
    }

    .dh-document__meta {
        padding-left: 0;
    }
}

.dh-clear-button {
    height: 38px;
    min-width: 104px;
    border: 1px solid #aebbd3;
    border-radius: 22px;
    background: #fff;
    color: #4b5568;
    padding: 0 18px;
    font: 1rem;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.dh-clear-button:hover,
.dh-clear-button:focus-visible {
    border-color: var(--dh-magenta);
    color: var(--dh-magenta);
    background: #fff7fa;
}

@media(max-width:640px) {
    .dh-clear-button {
        width: 100%;
    }
}

/* Tabletas y móviles */
@media (max-width: 768px) {
    .dh-document {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 4px 12px;
        padding: 5px 0;
    }

    .dh-document__main {
        grid-column: 1;
        min-width: 0;
    }

    .dh-document__size {
        grid-column: 2;
        padding: 0;
        border-right: 0;
        white-space: nowrap;
        text-align: right;
    }

    .dh-document__meta {
        grid-column: 1 / -1;
        min-width: 0;
        padding-left: 21px;
        flex-wrap: wrap;
    }
}