:root {
    --t360-primary: #2563eb;
    --t360-primary-hover: #1d4ed8;
    --t360-secondary: #64748b;
    --t360-success: #10b981;
    --t360-danger: #ef4444;
    --t360-warning: #f59e0b;
    --t360-bg-card: #ffffff;
    --t360-border-color: #e2e8f0;
    --t360-text-main: #1e293b;
    --t360-text-muted: #64748b;
    --t360-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --t360-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --t360-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Container */
.t360-dashboard-container {
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--t360-text-main);
    line-height: 1.5;
}

/* Typography Improvements */
.t360-dashboard-container h2,
.t360-dashboard-container h3 {
    color: var(--t360-text-main);
    font-weight: 700;
}

.t360-dashboard-container h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.t360-dashboard-container h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Header & Role Switcher */
.t360-role-switcher {
    margin-bottom: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Buttons - Unified Blue Style */
.t360-btn,
.t360-btn-submit,
.t360-btn-upload,
.t360-btn-secondary,
.t360-btn-logout {
    display: inline-flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    line-height: 1.25rem;
    background-color: var(--t360-primary) !important;
    color: white !important;
    box-shadow: var(--t360-shadow-sm);
    gap: 8px;
}

.t360-btn:hover,
.t360-btn-submit:hover,
.t360-btn-upload:hover,
.t360-btn-secondary:hover {
    background-color: var(--t360-primary-hover) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--t360-shadow);
}

.t360-btn:active,
.t360-btn-submit:active {
    transform: translateY(0);
}

/* Override for Logout only to distinguish if needed, but user asked for "All same blue" */
/* If user meant ALL same including logout, we keep them blue. Let's keep them blue as requested. */

/* Dashboard Stats */
.t360-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.t360-card {
    flex: 1;
    min-width: 220px;
    background: var(--t360-bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--t360-shadow);
    text-align: center;
    border: 1px solid var(--t360-border-color);
    transition: transform 0.2s ease;
}

.t360-card:hover {
    transform: scale(1.02);
}

.t360-card h3 {
    margin: 0 0 8px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--t360-text-muted);
}

.t360-card .money {
    font-size: 1.875rem;
    font-weight: 800;
    margin: 0;
    color: var(--t360-text-main);
}

.t360-card-income {
    border-top: 4px solid var(--t360-success);
}

.t360-card-expense {
    border-top: 4px solid var(--t360-danger);
}

.t360-card-overdue {
    border-top: 4px solid var(--t360-warning);
}

.t360-card-rejected {
    border-top: 4px solid var(--t360-warning);
}

/* Tabs */
.t360-tabs {
    display: flex;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 25px;
    gap: 4px;
}

.t360-tab-btn {
    flex: 1;
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 16px;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--t360-text-muted);
    border-radius: 8px;
}

.t360-tab-btn:hover {
    color: var(--t360-text-main);
    background-color: rgba(255, 255, 255, 0.5);
}

.t360-tab-btn.active {
    background-color: white;
    color: var(--t360-primary);
    box-shadow: var(--t360-shadow-sm);
}

/* Tables */
.t360-table-container {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--t360-border-color);
    overflow: hidden;
    box-shadow: var(--t360-shadow-sm);
}

.t360-table {
    width: 100%;
    border-collapse: collapse;
}

.t360-table th {
    background-color: #f8fafc;
    color: var(--t360-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 90px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--t360-border-color);
}

.t360-table td {
    padding: 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--t360-border-color);
}

.t360-table tr:last-child td {
    border-bottom: none;
}

.t360-table tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.t360-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 90px;
    font-weight: 700;
    text-transform: uppercase;
}

.t360-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.t360-status.paid {
    background: #d1fae5;
    color: #065f46;
}

.t360-status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.t360-status.approval_pending {
    background: #e0f2fe;
    color: #075985;
}

/* Modal Styles */
.t360-modal {
    display: none !important;
    /* Oculto por defecto */
    position: fixed !important;
    z-index: 99999999 !important;
    /* Elevado para superar footers de temas */
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden;
    /* El scroll lo maneja el modal-body */
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
}

/* Clase para abrir el modal */
.t360-modal.is-active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

.t360-modal-content {
    background-color: #ffffff;
    margin: auto !important;
    padding: 0;
    border-radius: 16px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: t360ModalSlide 0.3s ease-out;
    border: 1px solid var(--t360-border-color);
    position: relative !important;
    /* Base para el botón de cierre absoluto */
}

.t360-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--t360-border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background-color: #f8fafc;
    border-radius: 16px 16px 0 0;
}

/* Modales anchos para mensajería */
#modal-messaging-admin .t360-modal-content,
#modal-messaging .t360-modal-content {
    max-width: 1100px;
}

.t360-modal-body {
    padding: 30px;
    overflow-y: auto;
    background-color: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.t360-close {
    color: var(--t360-text-main) !important;
    background-color: #f8fafc !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    line-height: 1 !important;
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid var(--t360-border-color) !important;
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 999999999 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    user-select: none !important;
}

.t360-close:hover {
    background-color: var(--t360-danger) !important;
    color: white !important;
    transform: rotate(90deg) scale(1.1) !important;
    border-color: var(--t360-danger) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

@keyframes t360ModalSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Forms */
.t360-form-box {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--t360-border-color);
    box-shadow: var(--t360-shadow-sm);
    margin-bottom: 2rem;
}

.t360-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--t360-text-main);
}

.t360-form-group input,
.t360-form-group select,
.t360-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--t360-border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: #f8fafc;
}

.t360-form-group input:focus,
.t360-form-group select:focus,
.t360-form-group textarea:focus {
    outline: none;
    border-color: var(--t360-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: white;
}

/* WhatsApp Icon Wrapper Fixes */
.t360-wa-icon {
    background: #22c55e !important;
    display: inline-flex !important;
    padding: 6px !important;
}

.t360-wa-icon:hover {
    background: #16a34a !important;
    transform: scale(1.1);
}

/* ========================================
   MENÚ DE PESTAÑAS RESPONSIVE
   ======================================== */

/* Menú desplegable móvil - oculto por defecto */
.t360-tabs-mobile {
    display: none;
    margin-bottom: 20px;
}

.t360-mobile-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--t360-primary);
    border-radius: 8px;
    background-color: white;
    color: var(--t360-text-main);
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%232563eb' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.t360-mobile-select:focus {
    outline: none;
    border-color: var(--t360-primary-hover);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive Table */
@media screen and (max-width: 600px) {
    .t360-table thead {
        display: none;
    }

    .t360-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--t360-border-color);
        border-radius: 12px;
        background: #fff;
    }

    .t360-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        text-align: right;
        padding: 12px 16px;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        gap: 10px;
        min-height: 45px;
    }

    .t360-table td:before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: var(--t360-text-muted);
        font-size: 0.75rem;
        flex-shrink: 0;
        min-width: 90px;
    }
}

/* Responsive: Menú móvil */
@media screen and (max-width: 768px) {

    /* Mostrar menú desplegable en móviles */
    .t360-tabs-mobile {
        display: block !important;
    }

    /* Ocultar pestañas horizontales en móviles */
    .t360-tabs {
        display: none !important;
    }
}

/* VERSION CORRECTA - 29 DIC 2025 17:40 */


/* ========================================
   MENÚ DE ACCIONES MÓVIL
   ======================================== */

/* Ocultar por defecto en desktop */
.t360-mobile-actions-menu {
    display: none;
    position: relative;
}

.t360-menu-trigger {
    background: var(--t360-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--t360-shadow-sm);
}

.t360-menu-trigger:hover {
    background: var(--t360-primary-hover);
}

.t360-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    background: white;
    border: 1px solid var(--t360-border-color);
    border-radius: 8px;
    box-shadow: var(--t360-shadow-lg);
    min-width: 200px;
    z-index: 1000;
}

.t360-menu-dropdown.show {
    display: block;
}

.t360-menu-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.t360-menu-item:last-child {
    border-bottom: none;
}

.t360-menu-item:hover {
    background: #f8fafc;
}

.t360-menu-item.danger:hover {
    background: #fee2e2;
    color: var(--t360-danger);
}

@media screen and (max-width: 600px) {

    /* Ocultar botones desktop en móviles */
    .t360-desktop-actions {
        display: none !important;
    }

    /* Mostrar menú móvil */
    .t360-mobile-actions-menu {
        display: block !important;
    }
}

/* Forzar visibilidad correcta de acciones */
.t360-desktop-actions {
    display: flex !important;
}

@media screen and (max-width: 600px) {
    .t360-desktop-actions {
        display: none !important;
    }

    .t360-mobile-actions-menu {
        display: flex !important;
        justify-content: center !important;
    }

    .t360-menu-dropdown {
        position: fixed !important;
        right: 10px !important;
        left: auto !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE FIXES
   ============================================ */

/* Portal Vecino: Cards de resumen financiero (4 columnas → 1 columna en Mobile) */
@media screen and (max-width: 768px) {
    .t360-dashboard-container div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    .t360-dashboard-container div[style*="grid-template-columns: repeat(4"]>* {
        max-width: 100%;
    }
}

/* Portal Revisor: Cards de resumen (2 columnas → 1 columna en Mobile) */
@media screen and (max-width: 768px) {
    .t360-stats-row[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    .t360-stats-row[style*="grid-template-columns: 1fr 1fr"]>* {
        max-width: 100%;
    }
}

/* Sección Transparencia: Mejorar legibilidad de tabla en Mobile */
@media screen and (max-width: 600px) {
    #Transparencia .t360-table td {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    #Transparencia .t360-table td:before {
        min-width: auto;
        margin-bottom: 4px;
    }
}

/* ==============================
   PC: ANCHO PROGRESIVO DEL DASHBOARD
   ============================== */
@media screen and (min-width: 1024px) {
    .t360-dashboard-container {
        width: 96%;
        max-width: 1200px;
    }
}

@media screen and (min-width: 1440px) {
    .t360-dashboard-container {
        max-width: 1440px;
    }
}

@media screen and (min-width: 1920px) {
    .t360-dashboard-container {
        max-width: 1800px;
    }
}