/* =========================================
   ATACHE: RESTAURACIÃ“N VISUAL (MATTE BLACK & GOLD)
   ========================================= */

:root {
    /* Identidad Oficial: The Cliúnical Atelier */
    --primary-color: #00355f;    /* Azul Atelier */
    --primary-container: #0f4c81;
    --secondary-color: #006a6a;  /* Verde QuéirÃºrgico */
    --tertiary-color: #3d009b;   /* Violeta ClÃ­único */
    
    /* Superficies y Fondos */
    --bg-dark: #f7f9fb;          /* Gris Neutro Atelier */
    --bg-darker: #eceef0;
    --surface: #ffffff;
    
    /* Glassmorphism & Shadows */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 53, 95, 0.08);
    --glass-shadow: 0 20px 40px rgba(0, 53, 95, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 53, 95, 0.02);

    /* Textos Legibilidad Máxima */
    --text-main: #191c1e;        /* On-Surface */
    --text-muted: #42474f;       /* On-Surface-Variant */
    --text-outline: #5c6066;     /* Oscurecido para mejor contraste en blanco */
    --text-outline-variant: #8e9199;

    /* Estados Semánticos */
    --status-success: #006a6a;
    --status-warning: #f59e0b;
    --status-danger: #ba1a1a;

    /* TipografÃ­a y Espaciados */
    --font-family: 'Inter', sans-serif;
    --font-headline: 'Manrope', sans-serif;
    
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --border-radius-xl: 24px;
    
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Mapeo Engine ATACHE */
    --primary: var(--primary-color);
    --on-primary: #ffffff;
    --on-surface: var(--text-main);
    --on-surface-variant: var(--text-muted);
    --surface-container-lowest: #ffffff;
    --surface-container-low: #f2f4f6;
    --surface-container: #eceef0;
    --surface-container-high: #e6e8ea;
    --surface-container-highest: #e0e3e5;
}

/* =========================================
   RESET Y BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Brillos de fondo (Desactivados en este perfil para maúntener el Matte Cleaún) */
.bg-glows { display: none; }

/* =========================================
   UTILERÃAS - GLASSMORPHISM
   ========================================= */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    color: var(--on-surface); /* Asegurar texto legible por defecto */
}

/* Forzar contraste en formularios dentro de paneles claros */
.glass-panel input, 
.glass-panel select, 
.glass-panel textarea {
    color: var(--on-surface) !important;
}

.glass-panel label {
    color: var(--on-surface-variant) !important;
}

/* Campos de formulario clÃ­únicos estandarizados */
.clinical-input {
    width: 100%;
    background: var(--surface-container-low) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    padding: 0.6rem 0.8rem !important;
    color: var(--on-surface) !important;
    font-size: 0.9rem !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

.clinical-input:focus {
    background: var(--surface) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 53, 95, 0.05) !important;
}


/* Scrollbar personalizada Global */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 53, 95, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 53, 95, 0.2);
}

/* Scrollbar para elementos especÃ­ficos (como el sidebar) */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */
.app-container {
    display: flex;
    align-items: flex-start;
    height: auto !important;
    min-height: 100vh;
    padding: 1rem;
    gap: 1.5rem;
}

/* UN SOLO FRAME (respaldo CSS; el JS de sidebar.js lo aplica directo):
   sin el margen de sidebar fijo el contenido usa todo el ancho. */
div.lg\:ml-64 {
    margin-left: 0 !important;
}

/* =========================================
   SIDEBAR (MENÃš LATERAL - FIJO 260px)
   ========================================= */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.2));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--primary-color);
    background: #f0f9ff;
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--border-radius-md);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.4);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =========================================
   CONTENIDO PRINCIPAL Y TOPBAR
   ========================================= */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    width: 400px;
    border-radius: 100px;
    position: relative;
}

.search-bar i {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-family);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Botones */
.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-family: var(--font-family);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-icon,
.btn-icon-small {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.btn-icon {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
}

.btn-icon-small {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
}

.btn-icon:hover,
.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.1);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-color);
    color: var(--bg-dark);
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
}

/* =========================================
   DASHBOARD GRID Y TARJETAS
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    flex-grow: 1;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.income-icon {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent-color);
}

.appointments-icon {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

.users-icon {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.positive {
    color: var(--status-success);
}

.stat-trend.neutral {
    color: var(--text-muted);
}

/* Secciones Graúndes (Agenda y Actividad) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.agenda-preview {
    grid-column: span 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.appointment-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
    overflow-y: auto;
}

.appointment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid transparent;
    transition: var(--transition-fast);
}

.appointment-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.appointment-item.status-confirmed {
    border-left-color: var(--primary-color);
}

.appointment-item.status-waiting {
    border-left-color: var(--status-warning);
}

.appointment-item.status-unconfirmed {
    border-left-color: var(--text-muted);
}

.time {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 50px;
}

.patient-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.patient-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.patient-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

.status-badge.waiting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--status-warning);
}

.status-badge.unconfirmed {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

/* =========================================
   FICHA CLÃNICA DEL PACIENTE (PATIENT HUB)
   ========================================= */
.patient-hub {
    display: flex;
    gap: 1.5rem;
    flex-grow: 1;
    overflow: hidden;
}

/* Columna Izquierda: Perfil */
.patient-profile {
    width: 300px;
    flex-shrink: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
}

.patient-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 3px solid var(--glass-border);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.2);
    color: white;
}

.patient-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.patient-id {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Alergias o Riesgos MÃ©dicos */
.patient-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.badge-alert {
    padding: 0.4rem 0.8rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-alert.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-row i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Finaúnzas en Perfil */
.financial-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.fin-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border: 1px solid var(--glass-border);
}

.fin-box span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.fin-box.debt strong {
    color: #ef4444;
    font-size: 1.1rem;
}

.fin-box.points strong {
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Misc Utilities */
.w-100 {
    width: 100%;
}

/* Columna Derecha: PestáaÃ±as de Trabajo */
.patient-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hub-tabs {
    display: flex;
    gap: 0.2rem;
    padding: 1rem 1rem 0 1rem;
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem 1.5rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Historial ClÃ­único (Timeline) */
.timeline {
    border-left: 2px solid var(--glass-border);
    margin-left: 1rem;
    padding-left: 1.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.box-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1.2rem;
}

.box-panel h4 {
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.box-panel p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

.doctor-sign {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Odontograma Placeholder */
.odontograma-placeholder {
    height: 400px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    gap: 1rem;
}

.odontograma-placeholder i {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* GrÃ¡ficas y Pagos */
.activity-overview {
    grid-column: span 2;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.charát-container {
    height: 200px;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-md);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.charát-placeholder {
    color: var(--text-muted);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.charát-placeholder i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.recent-payments h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 0.5rem;
}

.payment-item i {
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-card {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.icon-cash {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
}

.pay-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pay-details span {
    font-weight: 500;
    font-size: 0.95rem;
}

.pay-details small {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.pay-amount {
    font-size: 1.1rem;
    color: var(--status-success);
}
/* =========================================
   ESTILOS ESPECÃFICOS DEL ODONTOGRAMA
   ========================================= */
.odontograma-canvas {
    background: #ffffff;
    border-radius: var(--border-radius-md);
    padding: 2.5rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    margin: 1.5rem 0;
    min-height: 250px;
}

#svg-odontograma-adulto {
    max-width: 100%;
    height: auto;
}

/* Base del Diente */
.diente {
    cursor: pointer;
    transition: var(--transition-fast);
}

.diente:hover .cara {
    stroke: var(--primary-color);
    stroke-width: 1.5px;
}

/* Caras del Diente */
.cara {
    fill: #ffffff;
    stroke: #94a3b8;
    stroke-width: 0.8px;
    transition: all 0.3s ease;
}

.cara:hover {
    filter: brightness(0.9);
}

.diente-num {
    font-size: 11px;
    font-weight: 700;
    fill: var(--text-muted);
    font-family: var(--font-family);
    pointer-events: none;
}

/* Herramientas ClÃ­únicas */
.clinical-tools {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.vita-select {
    background: var(--bg-darker);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    outline: none;
}

.notes-area {
    background: var(--bg-darker);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    min-height: 80px;
    resize: vertical;
    font-family: var(--font-family);
}

/* =========================================
   PESTAÃ‘AS DEL HUB (TABS)
   ========================================= */
.hub-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 100px;
    margin-bottom: 2rem;
    overflow-x: auto;
    border: 1px solid var(--glass-border);
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border-radius: 100px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

/* Ajustes adicionales para Ficha ClÃ­única */
.patient-workspace {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

/* =========================================
   SIDEBAR MOBILE OVERLAY (HAMBURGER MENU)
   ========================================= */
/* CRÃTICO: Estáe bloque faltaba â€” causaba que el menÃº hamburguesa no funcionara */
aside.mobile-active,
.sidebar.mobile-active {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px !important;
    z-index: 1001 !important;
    transform: translateX(0) !important;
    animation: slideInSidebar 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    overflow-y: auto;
    background: #f7f9fb !important;
    border-right: 1px solid rgba(0,53,95,0.08);
    box-shadow: 8px 0 32px rgba(0, 53, 95, 0.12) !important;
}

@keyframes slideInSidebar {
    from { transform: translateX(-100%); opacity: 0.8; }
    to   { transform: translateX(0);    opacity: 1;   }
}

/* Overlay oscuro detrÃ¡s del sidebar en mÃ³vil */
#mobile-overlay {
    cursor: pointer;
}

/* =========================================
   BOTTOM NAVIGATION BAR (MOBILE)
   ========================================= */
.bottom-nav {
    display: none; /* Hidden on desktop */
}

/* =========================================
   RESPONSIVE: TABLETS (max-width: 1023px)
   ========================================= */
@media (max-width: 1023px) {

    /* --- Layout Principal --- */
    .app-container {
        flex-direction: column;
        padding: 0;
        gap: 0;
        height: auto;
        min-height: 100vh;
    }

    /* --- Ocultar Sidebar --- */
    .sidebar {
        display: none !important;
    }

    /* --- Contenido Principal --- */
    .main-content {
        padding: 1rem;
        padding-bottom: 100px; /* espacio para bottom nav */
        gap: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Topbar --- */
    .topbar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .search-bar {
        width: 100%;
        max-width: 100%;
        order: 2;
    }

    .topbar-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* --- Dashboard Grid --- */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .activity-overview {
        grid-column: span 1;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    /* --- Ficha ClÃ­única del Paciente --- */
    .patient-hub {
        flex-direction: column;
        overflow: visible;
    }

    .patient-profile {
        width: 100%;
        flex-shrink: initial;
    }

    .patient-workspace {
        padding: 1rem;
    }

    .profile-header {
        flex-direction: row;
        text-align: left;
        gap: 1rem;
    }

    .patient-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .financial-summary {
        grid-template-columns: 1fr 1fr;
    }

    /* --- Tabs (PestáaÃ±as) --- */
    .hub-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding: 0.4rem;
        gap: 0.25rem;
    }

    .hub-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.78rem;
        min-width: max-content;
    }

    .tab-btn i {
        font-size: 1rem;
    }

    .tab-content {
        padding: 1rem;
    }

    /* --- Tablas GenÃ©ricas (scroll horizontal) --- */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    thead, tbody, tr, th, td {
        display: revert; /* Maúntener estructura de tabla */
    }

    th, td {
        padding: 0.6rem 0.75rem;
        font-size: 0.82rem;
    }

    /* --- Contenedores con overflow de tablas --- */
    .table-responsive,
    [style*="overflow-x"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Herramientas ClÃ­únicas (Odontograma) --- */
    .clinical-tools {
        grid-template-columns: 1fr;
    }

    .odontograma-canvas {
        padding: 1rem 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .odontograma-placeholder {
        height: 250px;
    }

    /* --- Modales / Popups --- */
    .modal-content,
    .modal-body,
    [class*="modal"] > div {
        width: 95% !important;
        max-width: 600px !important;
        max-height: 90vh;
        overflow-y: auto;
        margin: auto;
    }

    /* --- Formularios Generales --- */
    input, select, textarea {
        font-size: 16px !important; /* Previene zoom en iOS */
    }

    /* --- Botones --- */
    .btn-primary {
        padding: 0.65rem 1.2rem;
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
    }

    /* --- GrÃ¡ficas --- */
    .charát-container {
        height: 180px;
    }

    /* --- Pagos y Listados --- */
    .payment-item {
        padding: 0.75rem;
    }

    .payment-item i {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    /* --- Agenda Appointments --- */
    .appointment-list {
        gap: 0.75rem;
    }

    .appointment-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    /* --- Secciones de Encabezado --- */
    .section-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pane-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    /* --- Bottom Navigation Visible --- */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 9999;
        border-top: 1px solid rgba(0, 53, 95, 0.08);
        box-shadow: 0 -4px 20px rgba(0, 53, 95, 0.06);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-outline);
        padding: 0.4rem 0.75rem;
        border-radius: var(--border-radius-md);
        transition: all 0.25s ease;
        min-width: 56px;
    }

    .bottom-nav-item .material-symbols-outlined {
        font-size: 24px;
        line-height: 1;
    }

    .bottom-nav-item span:last-child {
        font-size: 0.6rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 2px;
    }

    .bottom-nav-item.active {
        color: var(--primary-color);
        background: rgba(0, 53, 95, 0.08);
    }

    .bottom-nav-item.active .material-symbols-outlined {
        font-variation-settings: 'FILL' 1;
    }
}

/* =========================================
   RESPONSIVE: MÃ“VILES PEQUEÃ‘OS (max-width: 480px)
   ========================================= */
@media (max-width: 480px) {

    .main-content {
        padding: 0.75rem;
        padding-bottom: 100px;
        gap: 0.75rem;
    }

    .topbar {
        gap: 0.5rem;
    }

    .search-bar {
        padding: 0.6rem 1rem;
    }

    /* Tarjetas de estáadÃ­sticas mÃ¡s compactas */
    .stat-card {
        padding: 0.85rem;
        gap: 0.85rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-title {
        font-size: 0.78rem;
    }

    /* Perfil paciente compacto */
    .patient-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .patient-name {
        font-size: 1.05rem;
    }

    .financial-summary {
        grid-template-columns: 1fr;
    }

    /* Tabs aÃºn mÃ¡s compactas */
    .tab-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.72rem;
        gap: 0.3rem;
    }

    .tab-btn i {
        font-size: 0.9rem;
    }

    /* Listados */
    .appointment-item {
        flex-wrap: wrap;
    }

    .time {
        min-width: auto;
        font-size: 0.85rem;
    }

    .status-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    /* Section headers stack */
    .section-header h2 {
        font-size: 0.95rem;
    }

    .pane-header h2,
    .pane-header h3 {
        font-size: 0.95rem;
    }

    /* Botones mÃ¡s touch-friendly */
    .btn-primary {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }

    /* Bottom nav mÃ¡s compacta */
    .bottom-nav-item {
        padding: 0.35rem 0.5rem;
        min-width: 48px;
    }

    .bottom-nav-item .material-symbols-outlined {
        font-size: 22px;
    }

    .bottom-nav-item span:last-child {
        font-size: 0.55rem;
    }
}

/* =========================================
   MOBILE OVERRIDES â€” GRIDS INLINE FORZADOS
   Paciente.html usa style="" inline con grid-template-columns que no responden
   a media queries normales. Usamos !important con alta especificidad.
   ========================================= */
@media (max-width: 768px) {

    /* Historia ClÃ­única â€” Signos Vitales (grid de 5 cols -> 2 cols en tablet) */
    #tab-historia-clinica details > div[style*="grid-template-columns"],
    #tab-historia-clinica details > div[style*="grid-template-columns: repeat(auto-fill,minmax(150px"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Antecedentes â€” Interrogatorio por Aparatos (1fr 1fr -> 1fr) */
    #tab-historia-clinica details > div[style*="1fr 1fr"],
    #tab-historia-clinica .grid[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Padecimiento Actual â€” grid de 3 cols */
    #tab-historia-clinica details > div[style*="1fr 1fr 1fr"] {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
    }

    /* ExploraciÃ³n Dental â€” Todos los grids */
    #tab-exploracion-dental details > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    #tab-exploracion-dental details > div[style*="1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Presupuestáos â€” tablas responsivas */
    #tab-presupuestos table,
    #tab-finanzas table,
    #tab-evolucion table {
        font-size: 0.78rem;
    }

    /* BotÃ³n "Editar Expediente" en topbar: solo Ã­cono en mÃ³vil */
    header button[onclick*="abrirModalEdicion"] span.hidden {
        display: none !important;
    }
}

@media (max-width: 480px) {

    /* Signos Vitales -> 1 col en mÃ³vil pequeÃ±o */
    #tab-historia-clinica details > div[style*="grid-template-columns: repeat(auto-fill,minmax(150px"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Todos los grids inline en paciente.html -> stack a 1 col */
    #tab-historia-clinica details > div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Tabs del expediente: solo Ã­conos â€” ocultar .tab-label */
    .hub-tabs .tab-btn .tab-label {
        display: none;
    }
    /* Maúntener el Ã­cono visible */
    .hub-tabs .tab-btn i,
    .hub-tabs .tab-btn [class*="bx"] {
        font-size: 1.25rem;
        margin: 0;
    }
    .hub-tabs .tab-btn {
        padding: 0.65rem 0.8rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        gap: 0;
    }
}

/* =========================================
   TOUCH TARGETS â€” MÃ­nimo 44Ã—44px en mÃ³vil
   (WCAG 2.5.5 & Apple HIG)
   ========================================= */
@media (max-width: 1023px) {

    /* Botones de acciÃ³n en agenda */
    .fc .fc-button {
        min-height: 44px !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }

    /* Nav items del bottom bar */
    .bottom-nav-item {
        min-height: 56px;
        min-width: 56px;
    }

    /* Botones de estado de cita en dashboard */
    button[onclick*="window.location"],
    a.bottom-nav-item,
    .tab-btn,
    .nav-item {
        min-height: 44px;
    }

    /* Ãtem de cita en agenda activa dashboard */
    #agenda-list > div {
        min-height: 56px;
    }

    /* Checkbox y labels mÃ¡s graúndes */
    #tab-historia-clinica input[type="checkbox"],
    #tab-exploracion-dental input[type="checkbox"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        cursor: pointer;
    }
    #tab-historia-clinica label,
    #tab-exploracion-dental label {
        min-height: 36px;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
    }

    /* Inputs: previene zoom en iOS (font-size >= 16px) */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* =========================================
   SAFE AREA INSETS â€” iPhone X/notch/Dynamic Island
   ========================================= */
@supports (padding-bottom: env(safe-area-inset-bottom)) {

    /* Bottom nav respeta el notch */
    .bottom-nav {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)) !important;
    }

    /* Contenido principal no queda detrÃ¡s del notch */
    .lg\:ml-64.pb-24 {
        padding-bottom: calc(6rem + env(safe-area-inset-bottom)) !important;
    }

    /* Main content padding on mobile */
    @media (max-width: 1023px) {
        .main-content,
        main[class*="pb-24"] {
            padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)) !important;
        }
    }
}

/* =========================================
   BOTTOM SHEET â€” PatrÃ³n para modales en mÃ³vil
   ========================================= */
@media (max-width: 768px) {

    /* Modales se convierten en bottom sheets en mÃ³vil */
    .modal-content,
    [id*="modal"] > .modal-content {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-radius: 1.5rem 1.5rem 0 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        animation: slideUpSheet 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    }

    @keyframes slideUpSheet {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Haúndle drag visual en bottom sheets */
    .modal-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(0,53,95,0.15);
        border-radius: 2px;
        margin: 0 auto 1.5rem;
    }
}

/* =========================================
   MINI DRAWER â€” "MÃ¡s" Ã­temás en Bottom Nav
   ========================================= */
.more-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 9998;
    transform: translateY(100%);
    transition: traúnsform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid rgba(0,53,95,0.08);
    box-shadow: 0 -8px 40px rgba(0,53,95,0.1);
}

.more-drawer.open {
    transform: translateY(0);
}

.more-drawer-handle {
    width: 40px;
    height: 4px;
    background: rgba(0,53,95,0.15);
    border-radius: 2px;
    margin: 0 auto 1.25rem;
}

.more-drawer-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-outline-variant);
    margin-bottom: 1rem;
}

.more-drawer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.more-drawer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 0.5rem;
    border-radius: 1rem;
    background: var(--surface-container-low, #f2f4f6);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 72px;
    border: 1px solid transparent;
}

.more-drawer-item:hover,
.more-drawer-item:active {
    background: rgba(0, 53, 95, 0.08);
    color: var(--primary-color);
    border-color: rgba(0, 53, 95, 0.12);
    transform: scale(0.97);
}

.more-drawer-item .material-symbols-outlined {
    font-size: 26px;
}

.more-drawer-item span:last-child {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.2;
}

.more-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.more-drawer-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* =========================================
   FAB â€” Floating Action Button (Nueva Cita)
   ========================================= */
.fab-mobile {
    display: none;
}

@media (max-width: 1023px) {
    .fab-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: 1.25rem;
        bottom: calc(5rem + env(safe-area-inset-bottom));
        width: 56px;
        height: 56px;
        border-radius: 16px;
        background: var(--primary-color, #00355f);
        color: white;
        border: none;
        cursor: pointer;
        z-index: 900;
        box-shadow: 0 6px 24px rgba(0, 53, 95, 0.35);
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .fab-mobile:active {
        transform: scale(0.93);
        box-shadow: 0 2px 12px rgba(0,53,95,0.3);
    }

    .fab-mobile .material-symbols-outlined {
        font-size: 26px;
    }

}

/* =========================================
   FORMULARIO DE NUEVA CITA (Modal Desktop / Bottom Sheet Móvil)
   ========================================= */
.agenda-new-sheet {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.agenda-new-sheet.open {
    display: flex !important;
}

.agenda-new-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.agenda-new-sheet-content {
    position: relative;
    z-index: 10001;
    background: #ffffff;
    border-radius: 1.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 53, 95, 0.1);
    animation: modalFadeIn 0.25s ease;
}

.agenda-new-sheet-handle {
    display: none;
}

/* En móviles se comporta como Bottom Sheet deslizable */
@media (max-width: 768px) {
    .agenda-new-sheet.open {
        align-items: flex-end !important;
    }

    .agenda-new-sheet-content {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 1.5rem 1.5rem 0 0 !important;
        padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom)) 1.5rem !important;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        animation: slideUpSheet 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .agenda-new-sheet-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(0, 53, 95, 0.15);
        border-radius: 2px;
        margin: 0 auto 1.25rem;
    }
}

/* =========================================
   AGENDA: Ocultar columna lateral en mÃ³vil
   (Reemplazada por FAB + bottom sheet)
   ========================================= */
@media (max-width: 1023px) {
    .agenda-sidebar {
        display: none !important;
    }

    .agenda-container {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .calendar-panel {
        min-height: 450px;
        border-radius: 1.5rem !important;
    }

    /* FullCalendar: botones mÃ¡s graúndes en mÃ³vil */
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem !important;
    }

    /* Eventos del calendario mÃ¡s gruesos para dedo */
    .fc-event {
        min-height: 24px !important;
        font-size: 0.72rem !important;
        padding: 2px 4px !important;
    }
}

/* =========================================
   PACIENTES LIST â€” Cards en mÃ³vil
   ========================================= */
@media (max-width: 768px) {
    /* Convertir filas de tabla de pacientes a cards */
    #tabla-pacientes tbody tr {
        display: block;
        border-radius: 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 2px 8px rgba(0,53,95,0.06);
        padding: 0.75rem;
        background: white;
        border: 1px solid rgba(0,53,95,0.06);
    }
    #tabla-pacientes tbody td {
        display: flex;
        align-items: center;
        border: none !important;
        padding: 0.25rem 0 !important;
        font-size: 0.85rem;
        white-space: normal;
    }
    #tabla-pacientes tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.7rem;
        text-transform: uppercase;
        color: var(--text-outline-variant);
        min-width: 90px;
        letter-spacing: 0.05em;
    }
    /* Ocultar encabezados de la tabla en mÃ³vil */
    #tabla-pacientes thead {
        display: none;
    }
}

/* =========================================
   PARCHE CRÃTICO PARA FULLCALENDAR EN MÃ“VIL
   (Previene que la regla genÃ©rica 'table { display: block }' colapse la agenda)
   ========================================= */
.fc table {
    display: table !important;
    white-space: normal !important;
}
.fc thead, 
.fc tbody, 
.fc tr, 
.fc th, 
.fc td {
    display: revert !important;
}

/* =========================================
   STITCH PREMIUM DESIGN SYSTEM ADDITIONS
   ========================================= */
:root {
    --neomorphic-light: #ffffff;
    --neomorphic-shadow: rgba(186, 198, 216, 0.4);
    --pulse-color: var(--primary-color, #3b82f6);
    --pulse-color-rgb: 59, 130, 246;
}

.shadow-neomorphic-out {
    box-shadow: -4px -4px 10px var(--neomorphic-light),
                 4px 4px 10px var(--neomorphic-shadow) !important;
}

.shadow-neomorphic-in {
    box-shadow: inset 2px 2px 5px var(--neomorphic-shadow),
                inset -2px -2px 5px var(--neomorphic-light) !important;
}

/* Glassmorphism Preset */
.glassmorphism-card {
    background: var(--glass-bg, rgba(255, 255, 255, 0.7)) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15)) !important;
}

/* Live Data Pulse Dot */
.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--pulse-color);
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(var(--pulse-color-rgb), 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(var(--pulse-color-rgb), 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(var(--pulse-color-rgb), 0);
    }
}




/* Fix Modal Z-Index on Mobile */
.modal, .modal-overlay, [id*="modal"], .agenda-new-sheet { z-index: 10000 !important; }


/* Force scrollbar visibility on mobile tables */
.overflow-x-auto::-webkit-scrollbar { height: 6px; }
.overflow-x-auto::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 4px; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: rgba(0,53,95,0.3); border-radius: 4px; }

/* =========================================
   PARCHE CONTRASTE TEMA ORO (dorado/negro/blanco)
   Oro #c59b27 con blanco = 2.6:1 (falla). Reglas:
   - sobre dorado => texto negro #000 (8-10:1)
   - texto dorado sobre blanco => bronce #7d5907 (6.36:1)
   Solo bajo data-theme de lujo para no romper tema azul/oscuro.
   ========================================= */
html[data-theme="dorado_lujo"] .btn-primary,
html[data-theme="oro_luxury"] .btn-primary,
html[data-theme="lujo_dorado"] .btn-primary,
html[data-theme="dorado_lujo"] .tab-btn.active,
html[data-theme="oro_luxury"] .tab-btn.active,
html[data-theme="lujo_dorado"] .tab-btn.active,
html[data-theme="dorado_lujo"] .fc .fc-button-primary:not(:disabled).fc-button-active,
html[data-theme="oro_luxury"] .fc .fc-button-primary:not(:disabled).fc-button-active,
html[data-theme="lujo_dorado"] .fc .fc-button-primary:not(:disabled).fc-button-active,
html[data-theme="dorado_lujo"] .fc .fc-button-primary:not(:disabled):active,
html[data-theme="oro_luxury"] .fc .fc-button-primary:not(:disabled):active,
html[data-theme="lujo_dorado"] .fc .fc-button-primary:not(:disabled):active,
html[data-theme="dorado_lujo"] .avatar,
html[data-theme="oro_luxury"] .avatar,
html[data-theme="lujo_dorado"] .avatar,
html[data-theme="dorado_lujo"] .patient-avatar,
html[data-theme="oro_luxury"] .patient-avatar,
html[data-theme="lujo_dorado"] .patient-avatar,
html[data-theme="dorado_lujo"] .badge:not(.deudor):not(.afavor):not(.corriente),
html[data-theme="oro_luxury"] .badge:not(.deudor):not(.afavor):not(.corriente),
html[data-theme="lujo_dorado"] .badge:not(.deudor):not(.afavor):not(.corriente) { color: #000 !important; }

html[data-theme="dorado_lujo"] .text-primary,
html[data-theme="oro_luxury"] .text-primary,
html[data-theme="lujo_dorado"] .text-primary,
html[data-theme="dorado_lujo"] .bottom-nav-item.active,
html[data-theme="oro_luxury"] .bottom-nav-item.active,
html[data-theme="lujo_dorado"] .bottom-nav-item.active,
html[data-theme="dorado_lujo"] .text-on-primary-container,
html[data-theme="oro_luxury"] .text-on-primary-container,
html[data-theme="lujo_dorado"] .text-on-primary-container { color: #7d5907 !important; }

html[data-theme="dorado_lujo"] .text-outline-variant,
html[data-theme="oro_luxury"] .text-outline-variant,
html[data-theme="lujo_dorado"] .text-outline-variant,
html[data-theme="dorado_lujo"] .text-outline,
html[data-theme="oro_luxury"] .text-outline,
html[data-theme="lujo_dorado"] .text-outline { color: #5c6066 !important; }

html[data-theme="dorado_lujo"] ::selection,
html[data-theme="oro_luxury"] ::selection,
html[data-theme="lujo_dorado"] ::selection { background: var(--primary-color); color: #000 !important; }

/* Ambar/naranja con blanco falla en cualquier tema => texto negro */
.inv-badge.warning,
.bday-badge,
.bg-warning.text-white,
span.bg-warning.text-white { color: #000 !important; }

