/* ============================================================================
   STYLES.CSS - Estilos mejorados con diseño responsive
   ============================================================================ */

/* ============================================================================
   VARIABLES CSS - Colores corporativos
   ============================================================================ */

:root {
    --primary-orange: #FB8707;
    --primary-red: #ED1C24;
    --background-cream: #F5F3EF;
    --background-white: #FFFFFF;
    --text-dark: #333333;
    --text-gray: #666666;
    --text-light: #999999;
    --border-light: #E0E0E0;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --info: #2196F3;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ============================================================================
   RESET Y BASE
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-cream);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ============================================================================
   PÁGINA DE LOGIN
   ============================================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--background-cream) 0%, #E8E5DD 100%);
}

.login-box {
    background: var(--background-white);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-factoria {
    margin-bottom: 1rem;
}

.logo-img {
    max-width: 180px;
    height: auto;
    margin: 0.5rem 0;
}

.login-box h1 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input {
    padding: 0.875rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(251, 135, 7, 0.1);
}

.form-group input.error {
    border-color: var(--error);
}

/* ============================================================================
   BOTONES
   ============================================================================ */

.btn-primary {
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #E67906;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--border-light);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    background: rgba(251, 135, 7, 0.05);
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: 6px;
}

.btn-icon:hover {
    background: var(--background-cream);
    transform: scale(1.1);
}

.btn-edit:hover {
    background: rgba(33, 150, 243, 0.1);
}

.btn-delete:hover {
    background: rgba(244, 67, 54, 0.1);
}

.btn-view:hover {
    background: rgba(76, 175, 80, 0.1);
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    background: var(--background-white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-header-img {
    max-height: 40px;
    width: auto;
}

.header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.btn-lang {
    background: transparent;
    border: 2px solid var(--border-light);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-lang:hover {
    border-color: var(--primary-orange);
}

.lang-current {
    color: var(--primary-orange);
    font-weight: 600;
}

.lang-alt {
    color: var(--text-gray);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background-cream);
    border-radius: 8px;
}

.user-name {
    font-weight: 500;
    color: var(--text-dark);
}

/* ============================================================================
   LAYOUT PRINCIPAL
   ============================================================================ */

.main-platform {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.platform-content {
    display: flex;
    flex: 1;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.sidebar {
    width: 260px;
    background: var(--background-white);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    border-radius: 8px;
    transition: var(--transition-fast);
}

.nav-item:hover {
    background: var(--background-cream);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary-orange), #FFA500);
    color: white;
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    font-size: 1.3rem;
}

/* ============================================================================
   CONTENIDO PRINCIPAL
   ============================================================================ */

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h3 {
    font-size: 1.8rem;
    color: var(--text-dark);
    font-weight: 600;
}

/* ============================================================================
   MÉTRICAS DASHBOARD
   ============================================================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--background-white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-normal);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.metric-content h4 {
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* ============================================================================
   TABLAS
   ============================================================================ */

.data-table {
    background: var(--background-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--background-cream);
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: rgba(251, 135, 7, 0.03);
}

tbody tr.highlight {
    background: rgba(251, 135, 7, 0.1);
    animation: pulse 1s ease;
}

@keyframes pulse {
    0%, 100% { background: rgba(251, 135, 7, 0.1); }
    50% { background: rgba(251, 135, 7, 0.2); }
}

tbody td {
    padding: 1rem;
    color: var(--text-dark);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.link-contrato {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.link-contrato:hover {
    text-decoration: underline;
    color: #E67906;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-active {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.badge-inactive {
    background: rgba(158, 158, 158, 0.15);
    color: var(--text-gray);
}

.badge-admin {
    background: rgba(251, 135, 7, 0.15);
    color: var(--primary-orange);
}

.badge-user {
    background: rgba(33, 150, 243, 0.15);
    color: var(--info);
}

/* ============================================================================
   MODALES
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--background-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 900px;
}

.modal-censo-xxlarge {
    max-width: 1200px;
    max-height: 95vh;
}

.modal-medium {
    max-width: 750px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    background: var(--background-cream);
    color: var(--text-dark);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ============================================================================
   TABS (PESTAÑAS) PARA MODAL DE CENSO
   ============================================================================ */

.tabs-container {
    border-bottom: 2px solid var(--border-light);
    background: var(--background-cream);
}

.tabs-navigation {
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
}

.tabs-navigation::-webkit-scrollbar {
    height: 6px;
}

.tabs-navigation::-webkit-scrollbar-thumb {
    background: var(--primary-orange);
    border-radius: 3px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--background-white);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--text-gray);
}

.tab-btn:hover {
    background: var(--background-cream);
    border-color: var(--primary-orange);
}

.tab-btn.active {
    background: var(--primary-orange);
    color: white;
    border-color: var(--primary-orange);
    font-weight: 600;
}

.tab-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
}

.tab-btn.active .tab-number {
    background: rgba(255, 255, 255, 0.3);
}

.tab-label {
    font-size: 0.9rem;
}

.tab-content {
    display: none;
    padding: 1.5rem;
    min-height: 400px;  /* ← AGREGAR ESTO */
}

.tab-content.active {
    display: block;
    min-height: 400px;  /* ← AGREGAR ESTO */
}

.tab-title {
    font-size: 1.3rem;
    color: var(--primary-orange);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    font-weight: 600;
}

/* ============================================================================
   ESTILOS PARA LISTA DE CONVIVIENTES
   ============================================================================ */

.convivientes-list {
    min-height: 100px;
    margin-bottom: 1.5rem;
}

.conviviente-card {
    background: var(--background-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-base);
}

.conviviente-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-orange);
}

.conviviente-info {
    flex: 1;
}

.conviviente-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.conviviente-details {
    font-size: 0.85rem;
    color: var(--text-gray);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.conviviente-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
}

.btn-icon:hover {
    background: var(--background-white);
    transform: scale(1.1);
}

.btn-icon.btn-edit:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.btn-icon.btn-delete:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-add-conviviente {
    width: 100%;
    margin-top: 1rem;
}

.no-data {
    text-align: center;
    color: var(--text-gray);
    font-style: italic;
    padding: 2rem;
}

/* ============================================================================
   FORM SECTIONS
   ============================================================================ */

.form-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-cream);
    border-radius: 8px;
}

.form-section h5 {
    font-size: 1rem;
    color: var(--primary-orange);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: var(--background-white);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--error);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--info);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    color: var(--text-dark);
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-dark);
}

/* ============================================================================
   PAGINACIÓN
   ============================================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Estilos para botones de paginación (alias de btn-pagination) */
.page-btn {
    padding: 0.625rem 1rem !important;
    margin: 0.25rem !important;
    border: 2px solid var(--border-light) !important;
    background: var(--background-white) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    transition: var(--transition-fast) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    min-width: 40px !important;
    text-align: center !important;
}

.page-btn:hover {
    border-color: var(--primary-orange) !important;
    color: var(--primary-orange) !important;
    background: rgba(251, 135, 7, 0.05) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

.page-btn.active {
    background: var(--primary-orange) !important;
    color: white !important;
    border-color: var(--primary-orange) !important;
    box-shadow: 0 4px 6px rgba(251, 135, 7, 0.3) !important;
}

.page-btn.active:hover {
    background: #E67906 !important;
    transform: translateY(-1px) !important;
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   BÚSQUEDA Y FILTROS
   ============================================================================ */

.search-bar {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(251, 135, 7, 0.1);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h2 {
        font-size: 1.2rem;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        z-index: 99;
        transition: var(--transition-normal);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    thead th, tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 2rem 1.5rem;
    }
    
    .header-left, .header-right {
        gap: 0.5rem;
    }
    
    .logo-header-img {
        max-height: 30px;
    }
    
    .user-info {
        display: none;
    }
}

/* ============================================================================
   UTILIDADES
   ============================================================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none !important;
}

/* ============================================================================
   INFORMES - ESTILOS ADICIONALES
   ============================================================================ */

.informe-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.informe-type-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.informe-type-card.clickable {
    cursor: pointer;
}

.informe-type-card.clickable:hover {
    border-color: #FB8707;
    box-shadow: 0 4px 12px rgba(251, 135, 7, 0.2);
    transform: translateY(-2px);
}

.informe-type-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.informe-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.informe-type-card h4 {
    font-size: 16px;
    margin: 12px 0 8px 0;
    color: #333;
    font-weight: 600;
}

.informe-type-card p {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.badge-disabled {
    display: inline-block;
    background: #ffc107;
    color: #000;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 12px;
}

/* Modal grande para formularios complejos */
.modal-large {
    max-width: 900px;
}

.modal-large .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 20px;
}

/* Secciones del formulario */
.form-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #FB8707;
}

.form-section h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

/* Filas de acciones */
.accio-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 2fr;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.accio-row .form-group {
    margin-bottom: 0;
}

.accio-row label {
    font-size: 12px;
    font-weight: 500;
}

.accio-row input {
    font-size: 13px;
}

#accionsContainer {
    margin-bottom: 16px;
}

/* Botones de acción en tablas */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons button {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-buttons .btn-secondary {
    background: #6c757d;
    color: white;
}

.action-buttons .btn-secondary:hover {
    background: #5a6268;
}

.action-buttons .btn-success {
    background: #28a745;
    color: white;
}

.action-buttons .btn-success:hover {
    background: #218838;
}

.action-buttons .btn-danger {
    background: #dc3545;
    color: white;
}

.action-buttons .btn-danger:hover {
    background: #c82333;
}

/* Filtros mejorados */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filters-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

/* Tabla responsive mejorada */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Error message */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.error-message p {
    margin: 0;
}

/* Loading state */
.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.loading-state p {
    color: #666;
    font-size: 14px;
    margin-top: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-large {
        max-width: 95%;
        margin: 20px auto;
    }
    
    .informe-types-grid {
        grid-template-columns: 1fr;
    }
    
    .accio-row {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}
/* ============================================================================
   NOTIFICACIONES EN HEADER
   ============================================================================ */

.notifications-container {
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.notifications-btn {
    background: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.2rem;
    position: relative;
    transition: var(--transition-fast);
}

.notifications-btn:hover {
    background: var(--background-cream);
    box-shadow: var(--shadow-sm);
}

.notifications-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.notifications-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-dark);
}

.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    display: flex;
    gap: 0.75rem;
    transition: var(--transition-fast);
}

.notification-item:hover {
    background: var(--background-cream);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.notification-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-gray);
}

.notification-time {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ============================================================================
   BADGES Y STATUS
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info);
    border: 1px solid var(--info);
}

.badge-secondary {
    background: rgba(158, 158, 158, 0.1);
    color: var(--text-gray);
    border: 1px solid var(--text-gray);
}

.badge-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

.badge-info {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info);
    border: 1px solid var(--info);
}

.badge-visits {
    font-weight: bold;
}

/* ============================================================================
   COMENTARIOS DE CENSO
   ============================================================================ */

.comment-item {
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--background-white);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-header strong {
    color: var(--text-dark);
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.comment-body {
    color: var(--text-gray);
    line-height: 1.5;
}

/* ============================================================================
   UTILIDADES ADICIONALES
   ============================================================================ */

.text-muted {
    color: var(--text-light) !important;
}

.text-center {
    text-align: center !important;
}

.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    gap: 1rem;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}


/* ============================================================================
   BOTÓN SUCCESS
   ============================================================================ */

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #45a049;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success:active {
    transform: translateY(0);
}

/* ============================================================================
   MODALES XL
   ============================================================================ */

.modal-xl {
    max-width: 1200px;
    width: 95%;
}

.modal-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    padding: 0 1.5rem;
    background: var(--background-cream);
}

.tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-gray);
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    padding: 1.5rem 0;
}

.tab-content.active {
    display: block;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.info-box {
    padding: 0.75rem;
    background: var(--background-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.link-contrato,
.link-property {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.link-contrato:hover,
.link-property:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .modal-tabs {
        overflow-x: auto;
    }
}

.dashboard-charts {
    margin-top: 30px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.chart-wide {
    grid-column: 1 / -1;
}

.search-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#searchDireccion:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(251, 135, 7, 0.1);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* Sección de comentarios en modal */
.comment-add-section {
    margin-bottom: 2rem;
}

.comments-list-section h4 {
    margin-bottom: 1rem;
    color: #333;
}

.comment-item {
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.comment-date {
    color: #999;
}

.comment-body {
    color: #333;
    line-height: 1.5;
}

#censoCommentsContainer:empty::after {
    content: "Sin visitas registradas";
    display: block;
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* ============================================================================
   SELECTOR DE TENANT
   ============================================================================ */
.tenant-selector {
    padding: 0.5rem 1rem;
    border: 2px solid white;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    min-width: 120px;
}

.tenant-selector:hover {
    background-color: rgba(0, 0, 0, 0.5);
    border-color: white;
    transform: translateY(-1px);
}

.tenant-selector:focus {
    background-color: rgba(0, 0, 0, 0.4);
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.tenant-selector option {
    background-color: #2c3e50;
    color: white;
    padding: 0.5rem;
    font-weight: 500;
}

/* Dashboard por tenant */
.tenant-dashboard {
    display: none;
}

.tenant-dashboard.active {
    display: block;
}

/* ============================================================================
   AVRA DASHBOARD ESPECÍFICO - Estilos para gráficos y KPIs
   ============================================================================ */

/* KPI Cards específicos de AVRA */
.avra-kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.avra-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.avra-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-orange);
}

.avra-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.avra-kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

.avra-kpi-card.blue .avra-kpi-icon { 
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-red) 100%); 
    color: white; 
}
.avra-kpi-card.green .avra-kpi-icon { 
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); 
    color: white; 
}
.avra-kpi-card.orange .avra-kpi-icon { 
    background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%); 
    color: white; 
}
.avra-kpi-card.purple .avra-kpi-icon { 
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%); 
    color: white; 
}
.avra-kpi-card.red .avra-kpi-icon { 
    background: linear-gradient(135deg, #f56565 0%, #dc2626 100%); 
    color: white; 
}
.avra-kpi-card.yellow .avra-kpi-icon { 
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); 
    color: white; 
}

.avra-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.avra-kpi-label {
    color: #666;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.avra-kpi-change {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-top: 0.75rem;
    font-weight: 600;
}

.avra-kpi-change.positive {
    background: #d4edda;
    color: #155724;
}

/* Sección narrativa */
.avra-narrative-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.avra-narrative-title {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.avra-narrative-content {
    color: #555;
    line-height: 1.8;
    font-size: 1rem;
    border-left: 4px solid var(--primary-orange);
    padding-left: 1.5rem;
}

/* Grid de gráficos AVRA */
.avra-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.avra-chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.avra-chart-title {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
}

.avra-chart {
    height: 350px;
    width: 100%;
}

/* Tabla de matrículas AVRA */
.avra-table-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 2rem;
}

.avra-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.avra-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.avra-search-input:focus {
    outline: none;
    border-color: var(--primary-orange);
}

.avra-filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avra-filter-btn:hover {
    background: var(--primary-red);
    transform: translateY(-1px);
}

.avra-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.avra-data-table thead {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-red) 100%);
    color: white;
}

.avra-data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avra-data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}

.avra-data-table tbody tr:hover {
    background: #f8f9fa;
    transition: background 0.2s ease;
}

/* Responsive */
@media (max-width: 1200px) {
    .avra-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .avra-kpi-cards {
        grid-template-columns: 1fr;
    }
    
    .avra-kpi-value {
        font-size: 1.75rem;
    }
    
    .avra-chart {
        height: 300px;
    }
    
    .avra-search-bar {
        flex-direction: column;
    }
    
    .avra-filter-btn {
        width: 100%;
    }
}

/* ============================================================================
   INDICADORES DE AUTO-LLENADO
   ============================================================================ */

.inquilino-loaded-indicator,
.usuario-asignado-indicator {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilo para campos readonly mejorado */
input:read-only:not([type="checkbox"]):not([type="radio"]),
select:disabled,
textarea:read-only {
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    color: #666 !important;
    border-color: #ddd !important;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Indicador de campo bloqueado */
.field-locked::after {
    content: "🔒";
    margin-left: 8px;
    opacity: 0.5;
}

/* Sub-navegación */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--background-cream);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.sub-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    border-radius: 8px;
    transition: var(--transition-fast);
    flex: 1;
    justify-content: center;
}

.sub-nav-item:hover {
    background: white;
}

.sub-nav-item.active {
    background: white;
    color: var(--primary-orange);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sub-nav-icon {
    font-size: 1.2rem;
}

.sub-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================
   INCIDENCIAS
   ============================================================================ */

.incidencia-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.incidencia-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.incidencia-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.incidencia-fecha {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.incidencia-fecha-icon {
    font-size: 1.2rem;
}

.incidencia-observaciones {
    color: #333;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.incidencia-imagenes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.incidencia-imagen-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.incidencia-imagen-item:hover {
    transform: scale(1.05);
}

.incidencia-imagen-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.incidencia-imagen-titulo {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.5rem;
    font-size: 0.85rem;
    text-align: center;
}

.incidencia-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.imagen-input-group {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    position: relative;
}

.imagen-input-group .form-group {
    margin-bottom: 0.75rem;
}

.imagen-input-group .btn-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.3s ease;
}

.imagen-input-group .btn-remove:hover {
    background: #d32f2f;
}

.incidencia-metadata {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #999;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.incidencia-metadata span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ============================================================================
   VISITAS DE CENSOS (DENTRO DE MODAL)
   ============================================================================ */

.visitas-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card.stat-success {
    border-color: #4caf50;
    background: #f1f8f4;
}

.stat-card.stat-danger {
    border-color: #f44336;
    background: #fef1f0;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-orange);
}

.stat-card.stat-success .stat-value {
    color: #4caf50;
}

.stat-card.stat-danger .stat-value {
    color: #f44336;
}

.visita-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.visita-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.visita-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.visita-fecha {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.visita-fecha-icon {
    font-size: 1.2rem;
}

.visita-comentario {
    color: #333;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.visita-actions {
    display: flex;
    gap: 0.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

/* Modal secundario con z-index mayor */
#visitaFormModal {
    z-index: 10001 !important;
}

#visitaFormModal .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}