html, body {
    background-color: #FDFCF9 !important;
}

/* Login ciudadano — layout split original refinado */
.login-ciudadano-split__brand {
    isolation: isolate;
}

.login-ciudadano-split__form {
    isolation: isolate;
}

.login-ciudadano-split__btn--primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .login-ciudadano-split__btn {
        transition: none !important;
    }
}

.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000; /* Asegura que las alertas estén por encima de todo */
  }
  
  .alert {
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
  }

  
/* Histórico ciudadano — tablas */
#tblHistorial tbody tr {
    transition: background-color 0.2s ease;
}

.historial-table-contract {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.historial-panel {
    border: 1px solid rgba(231, 229, 228, 0.95);
    background: #fff;
    box-shadow: 0 2px 12px -6px rgba(15, 23, 42, 0.08);
}

.historial-table-wrap {
    border-radius: 0.75rem;
}

.historial-table thead {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #78716c;
    background: rgba(245, 245, 244, 0.95);
}

.historial-table tbody tr:hover {
    background: rgba(97, 18, 50, 0.03);
}

/* Histórico — tarjetas de expediente (servidor público) */
#listaHistorialCards .historial-expediente-card {
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#listaHistorialCards .historial-expediente-card:hover {
    transform: translateY(-1px);
}

.historial-card-selected {
    background: linear-gradient(180deg, #ffffff 0%, #faf6f6 100%) !important;
}

.selected-row {
    background-color: #f5f5f4 !important;
}

/* Histórico ciudadano */
.historial-ciudadano .historial-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #78716c;
}

.historial-ciudadano .historial-select {
    display: block;
    width: 100%;
    border-radius: 0.625rem;
    border: 1px solid #d6d3d1;
    background: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1c1917;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.historial-ciudadano .historial-select:focus {
    border-color: #611232;
    box-shadow: 0 0 0 3px rgba(97, 18, 50, 0.12);
}

.historial-ciudadano .historial-select:disabled {
    cursor: not-allowed;
    background: #fafaf9;
    color: #a8a29e;
}

.historial-btn {
    display: inline-flex;
    min-height: 2.75rem;
    width: 100%;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.historial-btn--primary {
    border: none;
    background: #611232;
    color: #fff;
    box-shadow: 0 4px 14px -6px rgba(97, 18, 50, 0.55);
}

.historial-btn--primary:hover:not(:disabled) {
    background: #7a173f;
}

.historial-btn--primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.historial-btn--secondary {
    border: 1px solid #e7e5e4;
    background: #fff;
    color: #57534e;
}

.historial-btn--secondary:hover {
    border-color: rgba(97, 18, 50, 0.25);
    color: #611232;
}

.historial-count {
    margin: 0;
    padding: 0.25rem 0.65rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #a8a29e;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 9999px;
}

.historial-count:empty {
    display: none;
}

.historial-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
}

.historial-loading.is-active {
    display: flex;
}

.historial-loading__spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 2px solid #e7e5e4;
    border-top-color: #611232;
    border-radius: 50%;
    animation: historial-spin 0.7s linear infinite;
}

@keyframes historial-spin {
    to {
        transform: rotate(360deg);
    }
}

.historial-empty {
    margin: 0;
    padding: 1.25rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: center;
    color: #78716c;
    border-radius: 0.75rem;
    border: 1px dashed #e7e5e4;
    background: #fafaf9;
}

.historial-docs-table thead {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #78716c;
    background: rgba(245, 245, 244, 0.95);
}

.historial-docs-table th,
.historial-docs-table td {
    padding: 0.625rem 0.75rem;
    vertical-align: middle;
}

.historial-docs-cell--nombre {
    word-break: break-word;
    overflow-wrap: anywhere;
    color: #1c1917;
    font-weight: 500;
}

.historial-docs-cell--center {
    text-align: center;
}

.historial-docs-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #611232;
    cursor: default;
}

.historial-docs-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    color: #78716c;
    border-radius: 0.375rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.historial-docs-view:hover {
    color: #611232;
    background: rgba(97, 18, 50, 0.06);
}

.historial-docs-row:hover {
    background: rgba(97, 18, 50, 0.02);
}

@media (prefers-reduced-motion: reduce) {
    #listaHistorialCards .historial-expediente-card,
    .historial-loading__spinner {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

#alert-container {
    z-index: 9999 !important;
    position: fixed; /* o absolute, según tu diseño */
    top: 2rem;
    right: 2rem;
}

.login-title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    
    /* La magia del gradiente */
    background: linear-gradient(180deg, #FFFFFF 70%, #E0E0E0 100%);
    -webkit-background-clip: text; /* Corta el fondo para que solo se vea en el texto */
    -webkit-text-fill-color: transparent; /* Hace el color del texto transparente */
    background-clip: text;
    color: transparent; /* Fallback */
}

@media (min-width: 1024px) {
    .login-title {
        font-size: 3.75rem;
    }
}

/* Revisión CURP: tabla de documentos con nombres largos sin desbordar el layout */
#tblListaDocs.revision-docs-table {
    table-layout: fixed;
}

#tblListaDocs.revision-docs-table .revision-docs-col-nombre,
#tblListaDocs.revision-docs-table td:nth-child(5) {
    width: 42%;
    max-width: 48%;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

#tblListaDocs.revision-docs-table tbody td,
#tblListaDocs.revision-docs-table tbody th {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    padding-left: 0.375rem;
    padding-right: 0.375rem;
}

/* Hub ciudadano — inicio */
.hub-ciudadano {
    color: #161a1d;
}

.hub-hero {
    isolation: isolate;
}

/* Tarjetas de confianza — grid explícito (no depende solo de utilidades Tailwind) */
.hub-trust-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .hub-trust-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
}

.hub-trust-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    width: 100%;
    min-height: 10.5rem;
    padding: 1rem 0.875rem;
    text-align: center;
    border-radius: 0.75rem;
    border: 1px solid rgba(231, 229, 228, 0.9);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.hub-trust-card__icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: rgba(97, 18, 50, 0.08);
    color: #611232;
}

/* Contenedor flex: el <p> debe ser block para no partir strong + texto en ítems flex (colapsa espacios). */
.hub-trust-card__body {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 4.75rem;
    margin: 0.75rem 0 0;
}

.hub-trust-card__text {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 0.25rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    text-align: center;
    color: #57534e;
}

.hub-trust-card__text strong {
    font-weight: 600;
    color: #1c1917;
}

.hub-tramite-item {
    text-decoration: none;
}

#hubBtnLimpiarBusqueda.flex {
    display: flex;
}

/* Mi perfil ciudadano */
.perfil-dato-row dt {
    margin: 0;
}

/* Hub — otras aplicaciones (lista agrupada) */
.hub-apps-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(231, 229, 228, 0.9);
}

@media (min-width: 640px) {
    .hub-apps-section {
        margin-top: 3rem;
        padding-top: 2.5rem;
    }
}

.hub-apps-section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.hub-apps-section__badge {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #611232;
    background: rgba(97, 18, 50, 0.07);
    border-radius: 9999px;
}

.hub-apps-section__title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #44403c;
}

@media (min-width: 640px) {
    .hub-apps-section__title {
        font-size: 1.125rem;
    }
}

.hub-apps-section__lead {
    max-width: 36rem;
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #78716c;
}

.hub-apps-section__count {
    flex-shrink: 0;
    margin: 0;
    padding: 0.25rem 0.65rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #a8a29e;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 9999px;
}

.hub-apps-section__count:empty {
    display: none;
}

.hub-apps-panel {
    overflow: hidden;
    border-radius: 0.875rem;
    border: 1px solid rgba(231, 229, 228, 0.95);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.hub-apps-item {
    margin: 0;
    list-style: none;
}

.hub-apps-item + .hub-apps-item {
    border-top: 1px solid #f5f5f4;
}

.hub-apps-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

@media (min-width: 640px) {
    .hub-apps-link {
        padding: 1rem 1.125rem;
        gap: 1rem;
    }
}

.hub-apps-link:hover {
    background: rgba(97, 18, 50, 0.03);
}

.hub-apps-link:focus {
    outline: none;
}

.hub-apps-link:focus-visible {
    outline: 2px solid rgba(97, 18, 50, 0.35);
    outline-offset: -2px;
    background: rgba(97, 18, 50, 0.04);
}

.hub-apps-link__icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    border: 1px solid #f5f5f4;
    background: #fafaf9;
    color: #611232;
}

.hub-apps-link__icon svg {
    max-height: 1.375rem;
    max-width: 1.375rem;
}

.hub-apps-link__icon img {
    max-height: 1.5rem;
    max-width: 1.5rem;
    object-fit: contain;
}

.hub-apps-link__content {
    flex: 1 1 auto;
    min-width: 0;
}

.hub-apps-link__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
}

.hub-apps-link__title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1c1917;
}

.hub-apps-link:hover .hub-apps-link__title {
    color: #611232;
}

.hub-apps-link__tag {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a8a29e;
}

.hub-apps-link__desc {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #78716c;
}

.hub-apps-link__desc:empty {
    display: none;
}

.hub-apps-link__arrow {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    color: #d6d3d1;
}

.hub-apps-link:hover .hub-apps-link__arrow {
    color: #611232;
}

.hub-apps-empty {
    padding: 1.5rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: center;
    color: #78716c;
}

.hub-apps-item--skeleton .hub-apps-link {
    pointer-events: none;
}

.hub-apps-skel-icon,
.hub-apps-skel-line {
    border-radius: 0.375rem;
    background: #f5f5f4;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.hub-apps-skel-icon {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.hub-apps-skel-line {
    height: 0.75rem;
}

.hub-apps-skel-line--short {
    width: 40%;
    margin-top: 0.5rem;
}

.hub-apps-skel-line--title {
    width: 55%;
}

.hub-apps-skel-lines {
    flex: 1;
    min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
    .hub-apps-link,
    .hub-apps-skel-icon,
    .hub-apps-skel-line {
        transition: none !important;
        animation: none !important;
    }
}

/* Portal ciudadano — navbar y sidebar */
.citizen-nav {
    isolation: isolate;
}

.citizen-nav__brand {
    text-decoration: none;
    color: inherit;
}

.citizen-nav__wordmark {
    letter-spacing: -0.02em;
}

.citizen-drawer__logout a {
    text-decoration: none;
}

.citizen-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.citizen-sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Móvil: oculto por defecto */
.citizen-drawer.citizen-drawer--sidebar {
    transform: translateX(-100%);
}

.citizen-layout.citizen-sidebar-mobile-open .citizen-drawer.citizen-drawer--sidebar {
    transform: translateX(0);
}

.citizen-main {
    transition: padding-left 0.3s ease;
}

/* Escritorio: sidebar visible; colapsable a rail de iconos */
@media (min-width: 1024px) {
    .citizen-sidebar-backdrop {
        display: none !important;
    }

    .citizen-drawer.citizen-drawer--sidebar {
        transform: translateX(0);
    }

    .citizen-main {
        min-height: calc(100dvh - 4rem);
        padding-left: calc(18rem + 1.5rem);
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer.citizen-drawer--sidebar {
        width: 4.5rem;
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-main {
        padding-left: calc(4.5rem + 1.5rem);
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__label,
    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__head-text,
    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__section-label {
        opacity: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
        margin: 0;
        padding: 0;
        pointer-events: none;
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__collapse-icon {
        transform: rotate(180deg);
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer button[data-citizen-nav],
    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__logout a {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0;
    }

    .citizen-layout.citizen-sidebar-collapsed .citizen-drawer__logout a {
        min-width: 0;
    }

    [drawer-backdrop] {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .citizen-layout.citizen-sidebar-mobile-open {
        overflow: hidden;
    }
}

/* Footer portal ciudadano */
.citizen-footer {
    background: linear-gradient(180deg, #ffffff 0%, #FDFCF9 100%);
}

.citizen-footer a {
    text-decoration: none;
}

.citizen-main {
    padding-bottom: 1rem;
}

/* Footer genérico (servidor público / admin) */
.app-footer {
    position: relative;
    z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
    .citizen-drawer,
    .citizen-nav__menu-btn,
    .citizen-drawer button,
    .citizen-drawer a,
    .citizen-main,
    .citizen-sidebar-backdrop {
        transition: none !important;
    }
}