/* ============================================
   Unfold Overrides - Planta Alta / Iglu
   Colores del proyecto aplicados a unfold
   ============================================ */

[x-cloak] { display: none !important; }

/* --- Sidebar azul oscuro (#20325a) --- */
#nav-sidebar {
    background-color: #20325a !important;
    border-right-color: #1a2848 !important;
}

#nav-sidebar .flex.flex-col {
    background-color: #20325a !important;
}

/* Sidebar items - blanco, sin negrita */
#nav-sidebar ol a,
#nav-sidebar ol a span {
    color: #ffffff !important;
    font-weight: normal !important;
}

/* Sidebar section titles - blanco con negrita */
#nav-sidebar h2,
#nav-sidebar h3,
#nav-sidebar h4,
#nav-sidebar [class*="uppercase"] {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Sidebar hover */
#nav-sidebar a:hover,
#nav-sidebar a:hover span {
    background-color: rgba(0, 0, 0, 0.16) !important;
    color: #ffffff !important;
}

/* Sidebar active link */
#nav-sidebar a[aria-current="page"],
#nav-sidebar a[aria-current="page"] span,
#nav-sidebar a.bg-gray-100,
#nav-sidebar a.bg-gray-100 span {
    background-color: rgba(0, 0, 0, 0.25) !important;
    color: #ffffff !important;
}

/* Sidebar icons */
#nav-sidebar svg {
    color: #bdcadc !important;
}

#nav-sidebar a:hover svg,
#nav-sidebar a[aria-current="page"] svg {
    color: #ffffff !important;
}

/* Sidebar search */
#nav-sidebar input[type="search"],
#nav-sidebar input[type="text"] {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

#nav-sidebar input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Sidebar borders */
#nav-sidebar > div:first-child {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

#nav-sidebar > div:last-child {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

#nav-sidebar > div:last-child span,
#nav-sidebar > div:last-child a,
#nav-sidebar > div:last-child p {
    color: #bdcadc !important;
}

/* Sidebar logo text */
#nav-sidebar > div:first-child span {
    color: #ffffff !important;
}

/* Sidebar logo size */
#nav-sidebar img {
    height: 2rem !important;
}

/* Sidebar toggle button */
#nav-sidebar button svg {
    color: #bdcadc !important;
}

/* --- Adaptaciones de estilos originales del proyecto --- */

/* Fondo del área de contenido */
#main {
    background: #eff2f5 !important;
}

#main #content {
    background: #eff2f5 !important;
}

/* Boolean fields: solo mostrar punto de color, ocultar texto True/False */
td .flex .rounded-full + span {
    display: none !important;
}

/* ============================================
   ANCHO DEL CHANGELIST
   Solo en listados (body.change-list). El change_form conserva el ancho
   acotado de unfold para no perder legibilidad en los formularios.
   ============================================ */

body.change-list #iglu-content-wrapper {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    /* La barra inferior llega hasta el borde de la pantalla, como cuando
       queda fija (sticky) con listas largas. */
    padding-bottom: 0 !important;
}

/* Barra superior compacta: menos aire entre la topbar y el buscador.
   Gana sobre el margin-bottom general de #iglu-topbar por especificidad. */
body.change-list #iglu-topbar {
    margin-bottom: 0.25rem !important;
}

/* El listado ocupa siempre el alto de la pantalla y la barra inferior
   (acciones + paginación) queda anclada abajo. Sin esto, con pocos
   resultados la barra subía pegada a la tabla y debajo quedaba gris vacío.
   Cada contenedor desde #main hasta el form es columna flex y crece; la
   barra se empuja al fondo con margin-top: auto. Con listas largas no
   cambia nada: ahí ya manda el position: sticky de #iglu-bottom-bar. */
body.change-list #main,
body.change-list #iglu-content-wrapper,
body.change-list #content,
body.change-list #content-main,
body.change-list #changelist .changelist-form-container > .flex-grow,
body.change-list #changelist-form {
    display: flex !important;
    flex-direction: column !important;
}

body.change-list #iglu-content-wrapper,
body.change-list #content,
body.change-list #content-main,
body.change-list #changelist,
body.change-list #changelist-form {
    flex: 1 1 auto !important;
}

body.change-list #iglu-bottom-bar {
    margin-top: auto !important;
}

/* Anular el max-width del .container de Tailwind en los listados */
body.change-list #content {
    max-width: none !important;
    width: 100% !important;
}

/* ============================================
   DENSIDAD DEL CHANGELIST (global, todos los modelos)
   Replica la compacidad del admin anterior (django-jet).
   Alcance: solo tablas #result_list del listado. No afecta
   TabularInline del change_form ni tablas de simple_history.
   ============================================ */

/* Tipografía compacta en toda la tabla */
#result_list,
.changelist-container table {
    font-size: 0.75rem !important;
    line-height: 1.35 !important;
}

/* Encabezados: gris claro, mayúsculas, y con salto de línea permitido.
   El whitespace-nowrap de unfold es lo que fuerza columnas anchísimas. */
#result_list thead th,
#result_list thead th a,
.changelist-container table thead th,
.changelist-container table thead th a {
    text-transform: uppercase !important;
    font-weight: 600 !important;
    font-size: 0.66rem !important;
    letter-spacing: 0.02em !important;
    color: #7b8496 !important;
    background-color: #ffffff !important;
    white-space: normal !important;
}

#result_list thead th,
.changelist-container table thead th {
    padding: 0.85rem 0.55rem !important;
    vertical-align: bottom !important;
    max-width: 9rem !important;
}

/* Columna ordenada: resaltado suave, sin bloque gris fuerte */
#result_list thead th.sorted,
.changelist-container table thead th.sorted,
#result_list thead th.sorted a,
.changelist-container table thead th.sorted a {
    background-color: #ffffff !important;
    color: #374151 !important;
}

/* Celdas: padding reducido y línea divisoria suave.
   OJO: Django renderiza la columna enlazada (list_display_links) como <th>
   dentro del tbody, no como <td>. Hay que incluir ambos o esa columna
   se queda con el padding y el borde original de unfold. */
#result_list tbody td,
#result_list tbody th,
.changelist-container table tbody td,
.changelist-container table tbody th {
    border-bottom: 1px solid #edf0f3 !important;
    border-top: none !important;
    padding: 0.5rem 0.55rem !important;
    vertical-align: middle !important;
    max-width: 11rem !important;
}

/* Sin zebra: unfold alterna filas con bg-gray-50, jet las tenía blancas */
#result_list tbody tr,
#result_list tbody tr.bg-gray-50 {
    background-color: #ffffff !important;
}

#result_list tbody tr:hover {
    background-color: #f6f8fa !important;
}

/* Tabla dentro de una tarjeta blanca sobre el fondo gris, como en el admin
   anterior: a ras sobre blanco se veía plana. El borde se fuerza en todos
   los anchos (unfold solo lo pone desde lg:). */
#changelist-form > div[data-simplebar] {
    background-color: #ffffff !important;
    border: 1px solid #e3e7ec !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08) !important;
    padding: 0.25rem 0.75rem !important;
}

/* Enlaces dentro del changelist en azul (como el original).
   Incluye tbody th: es la celda de la columna enlazada. */
#result_list tbody td a,
#result_list tbody th a,
.changelist-container table tbody td a,
.changelist-container table tbody th a {
    color: #2f80ed !important;
    text-decoration: none !important;
}

#result_list tbody td a:hover,
#result_list tbody th a:hover,
.changelist-container table tbody td a:hover,
.changelist-container table tbody th a:hover {
    color: #1c64cf !important;
    text-decoration: underline !important;
}

/* La celda enlazada no debe verse en negrita ni con el color de encabezado */
#result_list tbody th {
    font-weight: 400 !important;
    color: inherit !important;
    text-transform: none !important;
}

/* Columna de checkbox: angosta */
#result_list thead th:first-child,
#result_list tbody td.action-checkbox {
    width: 2rem !important;
    max-width: 2rem !important;
    padding-left: 0.6rem !important;
    padding-right: 0.2rem !important;
}

/* ============================================
   TOPBAR: barra unificada breadcrumb + account links
   Aplica a TODOS los admins.
   ============================================ */

/* Barra superior: fondo blanco, sombra sutil, altura cómoda */
#iglu-topbar {
    background-color: #ffffff !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 1rem !important;
    padding: 0.75rem 0 !important;
    min-height: 3.2rem !important;
}

/* El wrapper del breadcrumb: quitar paddings/margins extra que meten las vistas hijas */
#iglu-breadcrumb-wrapper {
    display: flex !important;
    align-items: center !important;
    margin-left: 1.5rem !important;
}

#iglu-breadcrumb-wrapper > div {
    padding: 0 !important;
    margin: 0 !important;
}

#iglu-breadcrumb-wrapper > div > div {
    padding: 0 !important;
    margin: 0 !important;
}

/* Items del breadcrumb (li.text-xs de unfold): mayúsculas, color gris */
#iglu-breadcrumb-wrapper li.text-xs {
    text-transform: uppercase !important;
    font-size: 0.78rem !important;
    letter-spacing: 0.03em !important;
    color: #585f84 !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
}

#iglu-breadcrumb-wrapper li.text-xs a {
    color: #585f84 !important;
    text-decoration: none !important;
}

#iglu-breadcrumb-wrapper li.text-xs a:hover {
    color: #20325a !important;
}

/* Último item (página actual): negrita y color oscuro */
#iglu-breadcrumb-wrapper li.text-xs:last-child {
    color: #1f2937 !important;
    font-weight: 700 !important;
}

/* Ocultar el separador "/" de unfold y reemplazarlo por chevron verde "›" */
#iglu-breadcrumb-wrapper li.text-xs > span.mx-2 {
    display: none !important;
}

#iglu-breadcrumb-wrapper li.text-xs:not(:last-child)::after {
    content: "›";
    color: #3aa8ae;
    color: rgb(var(--color-primary-500));
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0.6rem;
    display: inline-block;
    line-height: 1;
}

/* Account links: alineados a la derecha */
#iglu-account {
    margin-left: auto !important;
    padding-right: 0.5rem !important;
}

#iglu-account a {
    color: #585f84 !important;
    font-size: 0.82rem !important;
    text-decoration: none !important;
}

#iglu-account a:hover {
    color: #20325a !important;
}

/* Barra superior y área del listado sobre el gris de la página: así
   resalta la tarjeta blanca de la tabla (ver #changelist-form > div[data-simplebar]). */
#changelist .changelist-form-container,
#changelist-search,
.changelist-filter-bar {
    background-color: transparent !important;
}

#changelist {
    background-color: transparent !important;
    padding-top: 0.25rem !important;
}

/* ============================================
   BARRA SUPERIOR DE LOS LISTADOS
   Título y botones de acción en la primera fila; debajo, buscador y
   filtros en una rejilla de cuatro columnas y el contador de resultados.
   ============================================ */

#iglu-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
}

.iglu-toolbar-left {
    min-width: 0 !important;
    margin: 0 !important;
}

/* Listados sin buscador ni filtros: el form queda vacío y sumaría un hueco. */
.iglu-toolbar-left:not(:has(#iglu-search-bar)) {
    display: none !important;
}

#iglu-toolbar-actions {
    order: -1;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.625rem !important;
}

/* El margen automático empuja los botones a la derecha. */
.iglu-page-title {
    margin: 0 auto 0 0;
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
}

#iglu-toolbar-actions .iglu-toolbar-btn,
#iglu-toolbar-actions #iglu-btn-generar-ref {
    height: 2.25rem !important;
    font-weight: 600 !important;
}

/* Barra de búsqueda + filtros inline */
#iglu-search-bar {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch !important;
    column-gap: 1rem !important;
    row-gap: 0.75rem !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

@media (max-width: 1100px) {
    #iglu-search-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #iglu-search-bar {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Celda del botón de aplicar y el de más filtros. Como es un solo elemento,
   la rejilla la coloca sola tras el último filtro, haya los que haya. */
#iglu-filter-submit {
    display: flex !important;
    gap: 0.75rem !important;
    min-width: 0 !important;
}

/* Search input */
#iglu-search-bar #toolbar,
#iglu-search-bar #toolbar .lg\:w-64,
#iglu-search-bar #toolbar > div:first-child {
    width: 100% !important;
    max-width: none !important;
    height: 2.25rem;
}

#iglu-search-bar #toolbar input {
    height: 100%;
}

/* Dropdown de filtros inline: angostos, para que quepan todos */
.iglu-inline-filter {
    border: 1px solid #d1d5db !important;
    border-radius: 0.25rem !important;
    padding: 0.4rem 0.5rem !important;
    font-size: 0.78rem !important;
    color: #374151 !important;
    background-color: #ffffff !important;
    background-image: none !important;
    cursor: pointer !important;
    height: 2rem !important;
    max-width: 10rem !important;
    text-overflow: ellipsis !important;
    appearance: auto !important;
    -webkit-appearance: menulist !important;
}

/* Botones de acción de la barra (Exportar, Importar, Añadir).

   OJO con las variables de color de unfold: en runtime valen canales RGB
   sueltos ("46 141 147"), no un color. `var(--color-primary-600)` a secas
   produce una declaración inválida que el navegador descarta — y con
   color:#fff encima el botón queda blanco sobre blanco, invisible.
   Hay que envolverla en rgb(), con un hex de respaldo en la línea previa. */
.iglu-toolbar-btn {
    background-color: #2e8d93 !important;
    background-color: rgb(var(--color-primary-600)) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 9999px !important;
    height: 2rem !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
    white-space: nowrap !important;
    transition: background-color 0.15s ease !important;
}

.iglu-toolbar-btn:hover {
    background-color: #3aa8ae !important;
    background-color: rgb(var(--color-primary-500)) !important;
    color: #ffffff !important;
}

/* Botón de aplicar filtros / buscar: llena el espacio libre de su celda. */
#iglu-btn-buscar {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    background-color: #2e8d93 !important;
    background-color: rgb(var(--color-primary-600)) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 0.375rem !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-block !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    white-space: nowrap !important;
    /* Misma altura que filtros, buscador y botones: si no, la fila baila. */
    height: 2.25rem !important;
}

#iglu-btn-buscar:hover {
    background-color: #2e8d93 !important;
}

/* Separar botones Importar / Exportar (dentro de tab_list de unfold) */
#content ul.border.rounded-md.shadow-sm {
    gap: 0.75rem !important;
    border: none !important;
    box-shadow: none !important;
}

#content ul.border.rounded-md.shadow-sm > li {
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
}

/* Botón "Añadir" flotante: volver a estilo de botón integrado verde */
.object-tools a.addlink,
a.addlink {
    background-color: #3aa8ae !important;
    background-color: rgb(var(--color-primary-500)) !important;
    color: #ffffff !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.9rem !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}

.object-tools a.addlink:hover,
a.addlink:hover {
    background-color: #2e8d93 !important;
    background-color: rgb(var(--color-primary-600)) !important;
}

/* ============================================
   BARRA INFERIOR del changelist (acciones + paginación + conteo)
   Replica el diseño original: action_bulk_original.png
   ============================================ */

/* Ocultar la paginación original de unfold (ya la mostramos en la barra inferior) */
#changelist-form > div > .bg-gray-50.flex.my-4 {
    display: none !important;
}

/* Contenedor principal de la barra inferior — sticky al fondo del viewport */
#iglu-bottom-bar {
    background-color: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    position: sticky;
    bottom: 0;
    z-index: 30;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.06);
}

/* Fila 1: action dropdown + IR a la izq, paginación a la der */
.iglu-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

/* Actions: dropdown + botón IR */
.iglu-bottom-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.iglu-bottom-actions select {
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    color: #374151;
    background-color: #ffffff;
    min-width: 10rem;
}

.iglu-bottom-actions label {
    display: none;
}

#iglu-btn-ir {
    background-color: #3aa8ae !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 0.25rem !important;
    padding: 0.4rem 1.4rem !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    display: inline-block !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    white-space: nowrap !important;
}

#iglu-btn-ir:hover {
    background-color: #2e8d93 !important;
}

/* Paginación: números alineados a la derecha */
.iglu-bottom-pagination {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.iglu-bottom-pagination a,
.iglu-bottom-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0 0.3rem;
    font-size: 0.82rem;
    color: #374151;
    text-decoration: none;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #ffffff;
}

.iglu-bottom-pagination a:hover {
    background-color: #e5e7eb;
}

.iglu-bottom-pagination span.this-page {
    background-color: #374151;
    color: #ffffff;
    border-color: #374151;
    font-weight: 600;
}

/* Fila 2: "seleccionados X de Y" a la izq, "N usuarios" a la der */
.iglu-bottom-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #6b7280;
}

.iglu-selection-count {
    color: #6b7280;
}

.iglu-total-count {
    color: #6b7280;
}

/* ============================================
   BOTÓN "GENERAR REFERENCIAS" (Pagos CIE)
   Naranja, como en el admin anterior.
   ============================================ */

#iglu-btn-generar-ref {
    background-color: #e67e22 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 9999px !important;
    height: 2rem !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
    white-space: nowrap !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: background-color 0.15s ease !important;
}

#iglu-btn-generar-ref:hover {
    background-color: #d3701c !important;
}

/* --- Modal de confirmación --- */

#iglu-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.iglu-confirm-box {
    background: #ffffff;
    border-radius: 0.5rem;
    width: 26rem;
    max-width: 95vw;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.iglu-confirm-title {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.iglu-confirm-subtitle {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    font-weight: 400;
    color: #6b7280;
}

.iglu-confirm-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.iglu-confirm-actions form {
    margin: 0;
}

#iglu-confirm-cancel {
    padding: 0.4rem 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 0.85rem;
    cursor: pointer;
}

#iglu-confirm-cancel:hover {
    background: #f3f4f6;
}

#iglu-confirm-ok {
    padding: 0.4rem 1rem;
    border-radius: 0.25rem;
    border: none;
    background: #e67e22;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

#iglu-confirm-ok:hover {
    background: #d3701c;
}

/* ============================================
   CONTADOR DE RESULTADOS (junto a BUSCAR)
   ============================================ */

#iglu-result-count {
    font-size: inherit;
    color: inherit;
    white-space: nowrap;
}

/* "resultados | Mostrar todo" ocupa su propia fila bajo los filtros. */
#iglu-result-note {
    grid-column: 1 / -1;
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
}

#iglu-result-note a {
    color: #2f80ed;
    text-decoration: none;
}

#iglu-result-note a:hover {
    text-decoration: underline;
}

.iglu-result-sep {
    color: #d1d5db;
    margin: 0 0.15rem;
}

/* ============================================
   NOMBRE DE USUARIO EN LA TOPBAR
   El admin anterior mostraba el usuario en una caja tipo select;
   unfold solo dejaba un icono de persona.
   ============================================ */

#iglu-account-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    border: 1px solid #d8dce5 !important;
    border-radius: 0.25rem !important;
    padding: 0.35rem 0.5rem 0.35rem 0.85rem !important;
    min-width: 11rem !important;
    background-color: #ffffff !important;
    text-decoration: none !important;
}

#iglu-account-trigger:hover {
    border-color: #b9c0ce !important;
}

.iglu-account-name {
    flex: 1 1 auto !important;
    font-size: 0.85rem !important;
    color: #585f84 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.iglu-account-caret {
    font-size: 20px !important;
    color: #9aa2b5 !important;
    flex: 0 0 auto !important;
}

/* ============================================
   BOTÓN "FILTROS DE FECHA"
   Abre el panel lateral de unfold, donde viven los filtros de rango
   (dos campos) que no caben como un solo control en la barra.
   ============================================ */

#iglu-btn-mas-filtros {
    flex: 0 0 2.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.3rem !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    padding: 0.4rem 0.7rem !important;
    height: 2.25rem !important;
    font-size: 0.78rem !important;
    color: #4b5563 !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

#iglu-btn-mas-filtros:hover {
    border-color: #9ca3af !important;
    color: #1f2937 !important;
}

/* Los widgets de filtro que inyecta unfold heredan clases de Tailwind
   con anchos grandes; se acotan para que quepan todos en la barra. */
/* Cada filtro llena su columna de la rejilla. El <select> que select2 oculta
   se excluye: si tomara ancho, dejaría de estar oculto del todo. */
#iglu-search-bar select.iglu-inline-filter:not(.select2-hidden-accessible),
#iglu-search-bar input.iglu-inline-filter {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 2.25rem !important;
    font-size: 0.875rem !important;
    box-sizing: border-box !important;
    /* line-height normal y padding vertical simétrico: así el navegador
       centra el texto del select nativo (el que se ve si select2 no carga). */
    line-height: normal !important;
    padding: 0 0.5rem !important;
    text-overflow: ellipsis !important;
}

/* "Más filtros" va solo con icono, junto al botón de aplicar. */
#iglu-btn-mas-filtros {
    padding: 0 !important;
    gap: 0 !important;
}

#iglu-btn-mas-filtros .iglu-btn-label {
    display: none !important;
}

/* ============================================
   COLUMNAS QUE NO DEBEN PARTIRSE
   El max-width general de celda parte textos cortos que en el admin
   anterior iban en una sola línea.
   ============================================ */

#result_list tbody td.field-link_receipt,
#result_list tbody td.field-expire_day_payment {
    max-width: none !important;
    white-space: nowrap !important;
}

/* ============================================
   SELECT2 EN LA BARRA DE FILTROS
   select2 sustituye el <select> por su propio markup, así que el ancho
   hay que fijarlo sobre .select2-container, no sobre .iglu-inline-filter.
   ============================================ */

/* select2 escribe un width inline calculado del contenido: hay que fijarlo
   con !important o cada filtro sale de un ancho distinto. */
#iglu-search-bar .select2-container {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    vertical-align: top !important;
}

/* El tema "admin-autocomplete" de Django centra el texto con line-height,
   no con altura (autocomplete.css: min-height 30px + line-height 30px).
   Por eso hay que igualar line-height al ALTO DE CONTENIDO, no al alto de
   la caja: 2.25rem de caja con border-box menos 2px de borde = 2.125rem.
   Con un valor mayor el texto cae abajo; con uno menor, queda arriba. */
#iglu-search-bar .select2-container .select2-selection--single,
#iglu-search-bar .select2-container--admin-autocomplete .select2-selection--single {
    height: 2.25rem !important;
    min-height: 2.25rem !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    background-color: #ffffff !important;
}

#iglu-search-bar .select2-container .select2-selection--single .select2-selection__rendered,
#iglu-search-bar .select2-container--admin-autocomplete .select2-selection--single .select2-selection__rendered {
    line-height: 2.125rem !important;
    font-size: 0.875rem !important;
    color: #374151 !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 1.6rem 0 0.6rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

#iglu-search-bar .select2-container .select2-selection--single .select2-selection__arrow,
#iglu-search-bar .select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow {
    height: 2.125rem !important;
    top: 1px !important;
    right: 0.25rem !important;
}

/* El contenedor también trae min-height propio del tema */
#iglu-search-bar .select2-container.select2-container--admin-autocomplete {
    min-height: 2.25rem !important;
}

/* El panel desplegable sí puede ser más ancho que el control */
.select2-container .select2-dropdown {
    min-width: 16rem !important;
    font-size: 0.8rem !important;
}

.select2-container .select2-results__option {
    padding: 0.35rem 0.6rem !important;
}

/* ============================================
   BOTONES "ENVIAR FICHA" (Fichas de propietario) y "ENVIAR FICHA CIE"
   (Pagos CIE). Verdes, junto a "Histórico", como en el admin anterior.
   Ver admin/rent/owner_record/change_form.html y
   admin/payments/payment_change_form.html.
   ============================================ */

#iglu-btn-enviar-ficha,
#iglu-btn-enviar-ficha-cie {
    background-color: #28a745 !important;
    color: #ffffff !important;
    font-weight: 500 !important;
}

#iglu-btn-enviar-ficha:hover,
#iglu-btn-enviar-ficha-cie:hover {
    background-color: #218838 !important;
}

/* ============================================
   Barras de scroll de tablas e inlines
   unfold envuelve el listado, los inlines tabulares y la lista de apps en
   SimpleBar, que oculta la barra nativa y dibuja un pulgar de ~7px, tenue y
   sin carril: casi no se ve. Con jet era la barra nativa del navegador
   (carril gris siempre visible). Se recupera ese aspecto: carril visible,
   pulgar más grueso y opaco, más oscuro al pasar el mouse (el carril tiene
   pointer-events:none, así que se usa la clase simplebar-hover que pone el JS).
   SimpleBar solo muestra el carril cuando hay desbordamiento (lo oculta
   inline con visibility:hidden), así que no aparece en tablas que caben.
   ============================================ */

.simplebar-track.simplebar-horizontal {
    height: 14px !important;
    background-color: #eef1f4 !important;
    border-radius: 7px !important;
}

.simplebar-track.simplebar-vertical {
    width: 14px !important;
}

.simplebar-track .simplebar-scrollbar:before,
.simplebar-track .simplebar-scrollbar.simplebar-visible:before {
    background-color: #9aa3ae !important;
    opacity: 1 !important;
    border-radius: 6px !important;
    top: 2px !important;
    bottom: 2px !important;
    left: 2px !important;
    right: 2px !important;
}

.simplebar-track .simplebar-scrollbar.simplebar-hover:before,
[data-simplebar].simplebar-dragging .simplebar-scrollbar:before {
    background-color: #6b7480 !important;
}
