/* assets/styles/dashboard.css - Estilos Exclusivos del Portal de Trámites */

/* Dashboard Main Container */
.dashboard-container {
    flex: 1;
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 220px 24px 60px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hero Section */
.dashboard-hero {
    text-align: center;
    margin-bottom: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.dashboard-hero h1 {
    font-size: 2.65rem;
    font-weight: 800;
    color: var(--color-spse-dark, #002d62);
    margin: 0 0 8px 0;
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.dashboard-hero p {
    font-size: 1.08rem;
    color: #64748b;
    margin: 0 0 14px 0;
    max-width: 580px;
    line-height: 1.5;
    font-weight: 400;
}

/* Acento de Línea Refactorizado con Rombo Central */
.hero-line-accent {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 180px;
    height: 12px;
    margin-top: 6px;
    margin-bottom: 24px;
}

.line-accent-stroke {
    position: absolute;
    width: 100%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 59, 148, 0.15) 18%, rgba(0, 59, 148, 0.55) 50%, rgba(0, 59, 148, 0.15) 82%, transparent 100%);
    border-radius: 99px;
}

.line-accent-node {
    width: 7px;
    height: 7px;
    background-color: #ffffff;
    border: 1.75px solid #003b94;
    transform: rotate(45deg);
    position: relative;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 45, 98, 0.15);
}

/* Barra de Búsqueda y Filtros Rápidos */
.tramites-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 580px;
}

.search-input-wrapper {
    position: relative;
    z-index: 50;
}

/* Autocompletado Desplegable Tipo Google */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
    padding: 6px 0;
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDropdown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.search-dropdown.hidden {
    display: none;
}

.dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f8fafc;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #f1f5f9;
}

.dropdown-item-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.dropdown-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    flex: 1;
    text-align: left;
}

.dropdown-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dropdown-badge.available {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.dropdown-badge.pending {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.dropdown-no-results {
    padding: 14px 16px;
    font-size: 0.88rem;
    color: #94a3b8;
    text-align: center;
}

/* ==========================================================================
   Control Responsivo de Filtros: Móvil (<768px) vs Escritorio/Tablet (>=768px)
   ========================================================================== */

/* 1. Escritorio, Monitores, Laptops y Tablets (>= 768px):
   Mostrar ÚNICAMENTE la barra segmentada con glider (.filter-pills-wrapper)
   y OCULTAR de forma absoluta el contenedor de filtro móvil. */
@media (min-width: 768px) {
    #mobile-filter-container,
    .mobile-filter-accordion {
        display: none !important;
    }

    #desktop-filter-container,
    .filter-pills-wrapper {
        display: inline-flex !important;
        position: relative !important;
        background-color: rgba(241, 245, 249, 0.95) !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        border-radius: 16px !important;
        padding: 6px !important;
        width: auto !important;
        box-sizing: border-box !important;
    }

    .filter-pills-wrapper .filter-btn {
        padding: 8px 18px !important;
        font-size: 0.88rem !important;
    }
}

/* 2. Celulares y Pantallas Pequeñas (< 768px):
   OCULTAR completamente la barra segmentada de escritorio
   y MOSTRAR ÚNICAMENTE la barra horizontal de filtro móvil. */
@media (max-width: 767px) {
    #desktop-filter-container,
    .filter-pills-wrapper {
        display: none !important;
    }

    #mobile-filter-container,
    .mobile-filter-accordion {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
    }
}

/* Estilos del Botón Disparador Móvil */
.mobile-filter-trigger-btn {
    width: 100% !important;
    height: 46px !important;
    padding: 0 16px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.mobile-filter-trigger-btn:hover,
.mobile-filter-trigger-btn:active {
    border-color: #003b94 !important;
}

/* Estilos del Desplegable Flotante Móvil */
.mobile-filter-dropdown-panel {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 35px -4px rgba(0, 30, 80, 0.18), 0 4px 10px rgba(0, 0, 0, 0.06) !important;
    z-index: 9999 !important;
    padding: 6px !important;
    display: none;
    flex-direction: column !important;
    gap: 4px !important;
}

.mobile-filter-dropdown-panel.is-open {
    display: flex !important;
    animation: mobileMenuDrop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes mobileMenuDrop {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mobile-filter-opt {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 11px 14px !important;
    border-radius: 12px !important;
    font-size: 0.93rem !important;
    font-weight: 600 !important;
    color: #334155 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.15s, color 0.15s !important;
    text-align: left !important;
}

.mobile-filter-opt:hover,
.mobile-filter-opt:active {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.mobile-filter-opt.active {
    background-color: #eff6ff !important;
    color: #003b94 !important;
    font-weight: 700 !important;
}

.opt-label-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.opt-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
}
.opt-dot.dot-blue { background-color: #003b94 !important; }
.opt-dot.dot-emerald { background-color: #10b981 !important; }
.opt-dot.dot-amber { background-color: #f59e0b !important; }

.pill-count {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 22px !important;
    height: 22px !important;
    padding: 0 7px !important;
    border-radius: 9999px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.pill-count.count-blue { background-color: #dbeafe !important; color: #003b94 !important; }
.pill-count.count-emerald { background-color: #d1fae5 !important; color: #047857 !important; }
.pill-count.count-amber { background-color: #fef3c7 !important; color: #b45309 !important; }

/* Glider Deslizante Animado */
.filter-glider,
#filter-glider {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 6px;
    width: 104px;
    border-radius: 12px;
    background-color: #003b94;
    box-shadow: 0 4px 14px -2px rgba(0, 59, 148, 0.4);
    z-index: 0;
    pointer-events: none;
    transition: left 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-btn {
    position: relative;
    z-index: 10;
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.25s ease;
    cursor: pointer;
    background: transparent !important;
    border: none;
    outline: none;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.filter-btn:not(.active):hover {
    color: #0f172a;
}

.filter-btn.active,
.filter-btn.active:hover {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.filter-btn .pill-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    background-color: rgba(226, 232, 240, 0.9);
    color: #475569;
    transition: all 0.25s ease;
}

.filter-btn.active .pill-count,
.filter-btn.active:hover .pill-count {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
}

/* Transiciones de Filtro y Layout de Tarjetas */
.tramites-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 1280px;
    margin-top: 30px;
    margin-bottom: 60px;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.4s ease;
}

.tramite-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg, 16px);
    padding: 34px 22px 26px 22px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.3s ease, opacity 0.35s ease;
    position: relative;
    overflow: hidden;
    min-height: 450px;
    height: auto;
    flex: 1 1 270px;
    max-width: 295px;
    width: 100%;
    margin: 0;
    will-change: transform, opacity;
}

/* Portada: Tarjetas compactas, sólidas y sin espacios muertos */
.spse-home-main .tramite-card {
    min-height: 308px;
}

@media (min-width: 640px) {
    .spse-home-main .tramite-card {
        min-height: 315px;
    }
}

.tramite-card.card-hiding {
    opacity: 0 !important;
    transform: scale(0.93) translateY(10px) !important;
    pointer-events: none;
}

.tramite-card.card-hidden-node {
    display: none !important;
}

@keyframes cardRevealFilter {
    0% {
        opacity: 0;
        transform: scale(0.88) translateY(20px);
    }
    60% {
        opacity: 0.9;
        transform: scale(1.02) translateY(-3px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tramite-card.card-filter-animate {
    animation: cardRevealFilter 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

.tramite-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -8px rgba(0, 45, 98, 0.1), 0 8px 12px -4px rgba(0, 45, 98, 0.04);
    border-color: rgba(0, 59, 148, 0.4);
}

/* Línea delgada y bonita institucional entre título y micro-pills */
.tramite-card-divider-line {
    width: 90%;
    max-width: 250px;
    height: 1.5px;
    margin: 8px auto 0 auto;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 59, 148, 0.15) 10%, rgba(0, 59, 148, 0.48) 50%, rgba(0, 59, 148, 0.15) 90%, transparent 100%);
    border-radius: 9999px;
}

.tramite-card.tramite-disabled .tramite-card-divider-line {
    background: linear-gradient(90deg, transparent 0%, rgba(148, 163, 184, 0.18) 10%, rgba(148, 163, 184, 0.48) 50%, rgba(148, 163, 184, 0.18) 90%, transparent 100%);
}

/* Micro-pills de características de trámites (Centradas verticalmente y bien aprovechadas) */
.tramite-card-features {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    flex: 1 1 auto;
    margin: 0;
    padding: 12px 0;
    position: relative;
    z-index: 10;
}

@media (min-width: 640px) {
    .tramite-card-features {
        flex-wrap: nowrap !important;
        gap: 8px;
        padding: 14px 0;
    }
}

.tramite-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4.5px 10px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 500;
    color: #475569;
    letter-spacing: -0.01em;
    line-height: 1.25;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .tramite-feature-pill {
        padding: 5px 11px;
        font-size: 0.75rem;
        gap: 5.5px;
    }
}

.tramite-card.tramite-available:hover .tramite-feature-pill {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.tramite-feature-icon {
    width: 13.5px;
    height: 13.5px;
    color: #003b94;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

@media (min-width: 640px) {
    .tramite-feature-icon {
        width: 14px;
        height: 14px;
    }
}

.tramite-card.tramite-available:hover .tramite-feature-icon {
    transform: scale(1.08);
}

.tramite-card .btn-tramite {
    margin-top: 0 !important;
}

/* Estado de pills en tarjetas deshabilitadas / próximas */
.tramite-card.tramite-disabled .tramite-feature-pill {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.tramite-card.tramite-disabled .tramite-feature-icon {
    color: #94a3b8;
}

/* Badges de Estado */
.tramite-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2.5px 7.5px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 3.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 2;
}

.badge-available {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    display: inline-block;
    animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* Badge de Importe / Tasa Dinámica en Esquina Superior Izquierda */
.tramite-cost-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.02em;
    z-index: 10;
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tramite-cost-badge .cost-label {
    color: #3b82f6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.tramite-cost-badge .cost-amount {
    font-weight: 700;
    color: #1e3a8a;
}

.tramite-cost-badge.disabled {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
    box-shadow: none;
}

.tramite-cost-badge.disabled .cost-label {
    color: #94a3b8;
}

.tramite-cost-badge.disabled .cost-amount {
    color: #64748b;
}



.badge-disabled {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.badge-lock-icon {
    width: 10px;
    height: 10px;
    color: #64748b;
}

/* Tarjetas Inactivas */
.tramite-card.tramite-disabled {
    background-color: #f8fafc;
    border: 1px solid #e9ecf1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.tramite-card.tramite-disabled:hover {
    transform: translateY(-4px);
    background-color: #f4f6f8;
    border-color: #d5dbe3;
    box-shadow: 0 8px 14px -4px rgba(0, 0, 0, 0.05);
}

.tramite-card.tramite-disabled .tramite-card-icon-img {
    opacity: 0.65;
    filter: none !important;
    transition: opacity 0.3s ease;
}

.tramite-card.tramite-disabled:hover .tramite-card-icon-img {
    opacity: 0.85;
    filter: none !important;
}

.tramite-card.tramite-disabled h3 {
    color: #8694a7;
}

.tramite-card.tramite-disabled .tramite-card-divider {
    background-color: #e2e8f0;
}

.tramite-card.tramite-disabled p {
    color: #94a3b8;
}

.tramite-card.tramite-disabled .btn-tramite.btn-pending {
    background-color: transparent;
    color: #94a3b8;
    border: none;
    cursor: default;
    font-weight: 500;
    font-size: 0.95rem;
    gap: 6px;
    box-shadow: none;
}

.tramite-card.tramite-disabled .btn-tramite.btn-pending:hover {
    background-color: transparent;
    color: #94a3b8;
    box-shadow: none;
    transform: none;
}

.tramite-card-icon-wrapper {
    width: 84px;
    height: 84px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .tramite-card-icon-wrapper {
        width: 92px;
        height: 92px;
        margin-bottom: 14px;
    }
}

.tramite-card:hover .tramite-card-icon-wrapper {
    background-color: transparent;
    transform: scale(1.08);
}

.tramite-card-icon-img {
    width: 68px;
    height: 68px;
    object-fit: contain;
    display: block;
}

@media (min-width: 640px) {
    .tramite-card-icon-img {
        width: 76px;
        height: 76px;
    }
}

.tramite-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-spse-dark, #002d62);
    margin: 0 0 10px 0;
    line-height: 1.28;
    min-height: 2.6em;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .tramite-card h3 {
        font-size: 1.28rem;
        min-height: 2.8em;
    }
}

.tramite-card-divider {
    width: 100%;
    height: 1px;
    background-color: #f1f5f9;
    margin-bottom: 12px;
}

.tramite-card p {
    font-size: 0.90rem;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 14px 0;
    flex: 1;
}

@media (min-width: 640px) {
    .tramite-card p {
        font-size: 0.95rem;
        line-height: 1.52;
    }
}

/* Bottom Info Bar */
.dashboard-info-bar {
    background: rgba(244, 247, 255, 0.45);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    padding: 32px 36px;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
    box-shadow: 0 10px 30px -5px rgba(0, 45, 98, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(8px);
}

.info-bar-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
}

.info-bar-item:not(:last-child) {
    border-right: 1px solid rgba(226, 232, 240, 0.8);
    padding-right: 36px;
}

.info-bar-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #edf2fb;
    color: #002d62;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 45, 98, 0.06);
    border: 1px solid rgba(0, 59, 148, 0.12);
}

.info-bar-icon-wrapper svg {
    width: 20px;
    height: 20px;
}

.info-bar-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-bar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-spse-dark, #002d62);
}

.info-bar-description {
    font-size: 0.85rem;
    color: var(--color-text-muted, #64748b);
    line-height: 1.5;
}

/* Responsivo para Móviles y Tablets */
@media (max-width: 1024px) {
    .dashboard-info-bar {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .info-bar-item:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-right: 0;
        padding-bottom: 24px;
    }
}

@media (max-width: 640px) {
    .dashboard-container {
        padding-top: 135px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .dashboard-hero h1 {
        font-size: 1.85rem;
    }
    .dashboard-hero p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    .tramites-filter-bar {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 12px;
    }
    .search-input-wrapper {
        width: 100%;
        min-width: 100%;
    }
    .filter-pills-wrapper {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        padding: 5px !important;
        box-sizing: border-box !important;
    }
    .filter-btn {
        padding: 8px 11px !important;
        font-size: 0.81rem !important;
        gap: 6px !important;
        flex: 1 0 auto !important;
    }
    .filter-btn .pill-count {
        font-size: 0.7rem !important;
        padding: 1.5px 6px !important;
    }
    .tramite-card {
        max-width: 100% !important;
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   Optimizaciones de Rendimiento de Rendereado (60 FPS en Dispositivos Móviles)
   ========================================================================== */
.dashboard-header {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.header-bg-shapes,
.header-shape,
.header-bottom-line {
    transform: translateZ(0);
    backface-visibility: hidden;
}

@media (max-width: 850px) {
    /* Desactivar re-calculos pesados de layout en scroll de celulares */
    .dashboard-header {
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out !important;
    }

    /* Acelerar menú desplegable en celular */
    .dashboard-header .header-nav {
        will-change: opacity, transform;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    /* Menú desplegable hamburguesa activo */
    .dashboard-header .header-nav.menu-open {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        display: flex !important;
        visibility: visible !important;
    }

    /* Detener orbes de fondo animados en celulares para liberar ciclos de GPU/CPU */
    .bg-ambient-orb {
        animation: none !important;
        filter: blur(40px) !important;
        opacity: 0.35 !important;
    }

    /* Simplificar formas complejas con sesgo del header en celulares */
    .header-shape {
        transition: none !important;
    }
}

/* Carrusel continuo de trámites de la portada */
.spse-home-main .tramites-groups {
    width: 100%;
    max-width: 925px;
}

.spse-home-main .tramites-group {
    position: relative;
    min-width: 0;
}

.spse-home-main .tramites-carousel-controls {
    position: absolute;
    z-index: 20;
    top: 50%;
    right: -64px;
    left: -64px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: auto;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
    transform: translateY(-50%);
}

.spse-home-main .tramites-carousel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #003b94;
    background: #ffffff;
    border: 1px solid #dbe5f2;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 45, 98, 0.07);
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.spse-home-main .tramites-carousel-button svg {
    width: 20px;
    height: 20px;
}

.spse-home-main .tramites-carousel-button:hover {
    color: #ffffff;
    background: #003b94;
    border-color: #003b94;
    transform: translateY(-1px);
}

.spse-home-main .tramites-carousel-button:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

.spse-home-main .tramites-group .tramites-grid {
    position: relative;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 20px !important;
    max-width: 925px !important;
    margin: 0 auto !important;
    padding: 14px 4px 22px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4px;
    scrollbar-width: none;
}

.spse-home-main .tramites-group .tramites-grid::-webkit-scrollbar {
    display: none;
}

.spse-home-main .tramite-card {
    flex: 0 0 calc((100% - 40px) / 3);
    max-width: none !important;
    scroll-snap-align: start;
}

@media (max-width: 1100px) {
    .spse-home-main .tramites-carousel-controls {
        right: 0;
        left: 0;
    }

    .spse-home-main .tramites-group .tramites-grid {
        padding-inline: 46px;
        scroll-padding-inline: 46px;
    }

    .spse-home-main .tramite-card {
        flex-basis: min(40vw, 295px);
    }
}

@media (max-width: 640px) {
    .spse-home-main .tramites-carousel-button {
        width: 36px;
        height: 36px;
    }

    .spse-home-main .tramites-group .tramites-grid {
        padding-inline: 42px;
        scroll-padding-inline: 42px;
    }

    .spse-home-main .tramite-card {
        flex-basis: min(calc(100vw - var(--home-gutter) - var(--home-gutter) - 84px), 340px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spse-home-main .tramites-group .tramites-grid {
        scroll-behavior: auto;
    }
}

/* Enlace de regreso al listado, compartido por las pantallas de trámites */
.tramites-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 16px;
    padding: 4px 0;
    color: #53647c;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease;
}

.tramites-back-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tramites-back-link:hover {
    color: #003b94;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tramites-back-link:focus-visible {
    border-radius: 4px;
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 4px;
}

.workflow-main-container > .tramites-back-link {
    margin-bottom: -24px;
}

.workflow-main-container > .tramites-back-link--bottom {
    margin-top: -16px;
    margin-bottom: 0;
}

@media (max-width: 845px) {
    .workflow-main-container > .tramites-back-link {
        margin-bottom: -8px;
    }

    .workflow-main-container > .tramites-back-link--bottom {
        margin-top: -8px;
    }
}

@media (max-width: 640px) {
    .workflow-main-container > .tramites-back-link {
        margin-bottom: -2px;
    }

    .workflow-main-container > .tramites-back-link--bottom {
        margin-top: -2px;
    }
}

@media (max-width: 640px) {
    .dashboard-container.spse-home-main {
        padding-top: 140px;
    }
}
