/* ========================
   Variables de colores
======================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

:root {
    --primary-color: #3d7ab8;
    --primary-dark: #2f6499;
    --accent-color: #e88b4a;
    --secondary-color: #e88b4a;
    --success-color: #2a9d8f;
    --danger-color: #c23b22;
    --bg-color: #f0f5fb;
    --sidebar-bg: #4a7eb5;
    --sidebar-bg-deep: #3a6a9a;
    --sidebar-bg-light: #6ba3d4;
    --sidebar-text: #f4f9ff;
    --white: #fff;
    --text-dark: #212529;
    --border-color: #e0e0e0;
    --card-bg: var(--white);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Tipografía base y legibilidad */
html { font-size: 16px; }
body { line-height: 1.6; }

/* ========================
   Estilo base del cuerpo y tipografía
======================== */
body {
    font-family: 'Inter', 'Bahnschrift SemiBold', Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    display: flex;
    color: var(--text-dark);
}

/* -------------------------------------- */
/* Layout y Contenedores */
/* -------------------------------------- */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 28px 30px 40px;
    min-height: 100vh;
    width: calc(100% - 260px);
    transition: margin-left 0.25s ease, width 0.25s ease;
}

/* -------------------------------------- */
/* Sidebar (Barra Lateral) — layout unificado */
/* -------------------------------------- */
.sidebar {
    width: 260px;
    background: linear-gradient(168deg, var(--sidebar-bg-light) 0%, var(--sidebar-bg) 38%, var(--sidebar-bg-deep) 100%);
    color: var(--sidebar-text);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 22px rgba(36, 72, 110, 0.28);
    border-right: 1px solid rgba(255, 255, 255, 0.22);
    z-index: 1040;
    transition: left 0.25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    text-align: center;
    padding: 22px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-title {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.sidebar-brand-icon {
    font-size: 1.35rem;
    color: var(--accent-color);
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 12px 10px;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.96);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s ease, transform 0.15s ease;
    border: 1px solid transparent;
}

.sidebar-link i {
    color: var(--accent-color);
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transform: translateX(2px);
    border-color: rgba(255, 255, 255, 0.25);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-link.active i {
    color: #ffe8c8;
}

.sidebar-footer {
    padding: 12px 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-backup-form {
    margin-bottom: 10px;
}

.btn-sidebar-backup {
    background: linear-gradient(180deg, #e67e22 0%, #c96a12 100%);
    color: #fff;
    border: none;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 10px;
}

.btn-sidebar-backup:hover {
    background: linear-gradient(180deg, #f08a2a 0%, #d67414 100%);
    color: #fff;
}

.sidebar-link-logout {
    margin-bottom: 0;
}

/* Compatibilidad: enlaces directos en sidebar antiguo */
.sidebar a:not(.sidebar-link) {
    color: var(--white);
    text-decoration: none;
    display: block;
    padding: 12px 20px;
    transition: background 0.3s ease;
}

.sidebar a:not(.sidebar-link):hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    background: linear-gradient(180deg, var(--sidebar-bg-light), var(--sidebar-bg));
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1100;
    border-radius: 5px;
}

/* Responsive: mostrar botón de menú y ocultar sidebar en pantallas pequeñas */
@media (max-width: 991px) {
    .menu-toggle { display: block; }
    .sidebar { left: -260px; width: 260px; transition: left 0.25s ease; }
    body.sidebar-open .sidebar { left: 0; }
    .main-content { margin-left: 0; padding: 16px; }
}

/* Cuando el sidebar está visible en pantallas pequeñas, añadir overlay ligero */
@media (max-width: 991px) {
    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 1050;
    }
}

/* -------------------------------------- */
/* Tarjetas (Cards) */
/* -------------------------------------- */
.card, .form-container, .table-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.card.orange { border-top: 5px solid var(--secondary-color); }
.card.green { border-top: 5px solid var(--success-color); }

/* -------------------------------------- */
/* Botones */
/* -------------------------------------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: background 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #2a5c91;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #c95c1f;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #b02a37;
}

.btn-volver {
    background: #6c757d;
    color: var(--white);
}

.btn-volver:hover {
    background: #5a6268;
}

.btn-backup-manual {
    background-color: #FF6F00; /* Naranja del index */
    color: var(--white);
}

.btn-backup-manual:hover {
    background-color: #e06200; /* Naranja más oscuro */
    color: var(--white);
}

/* -------------------------------------- */
/* Formularios */
/* -------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-dark);
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(48, 107, 169, 0.2);
}

/* -------------------------------------- */
/* Tablas */
/* -------------------------------------- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* Encabezados de tabla legacy (no aplicar a consultas-table ni tablas Bootstrap) */
table:not(.consultas-table):not(.table) th,
.table-container th {
    background-color: var(--primary-color);
    color: var(--white);
    text-transform: uppercase;
    font-size: 0.9em;
}

/* -------------------------------------- */
/* Mensajes de Alerta */
/* -------------------------------------- */
.alert-box {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* -------------------------------------- */
/* Media Queries (Responsivo) */
/* -------------------------------------- */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
    .menu-toggle {
        display: block;
    }
    .header-card, .search-bar form {
        flex-direction: column;
        align-items: stretch;
    }
    .header-card h1 {
        margin-bottom: 15px;
    }
}
/* =======================
   Página de Login
======================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-color);
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border-top: 5px solid var(--primary-color);
    animation: fadeIn 0.8s ease-in-out;
}

.login-header {
    margin-bottom: 20px;
}

.login-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(48, 107, 169, 0.2);
}

.btn.btn-block {
    width: 100%;
    margin-top: 10px;
}

.page-footer {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
    color: #777;
    font-size: 0.8em;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
    .login-container {
        padding: 20px;
    }
}
/* --- Responsividad para pantallas pequeñas (ej. tablets y móviles) --- */
@media (max-width: 992px) {
    /* Sidebar en off-canvas para móviles: desplazado fuera de pantalla mediante 'left' */
    .sidebar {
        left: -260px;
        width: 260px;
        display: block;
        transition: left 0.25s ease;
        height: 100vh;
    }

    /* Mostrar el sidebar cuando el body tenga la clase sidebar-open (toggle) */
    body.sidebar-open .sidebar { left: 0; }

    /* El contenido principal ocupará el 100% del ancho */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem; /* Ajustar el padding para móviles */
    }
    
    /* Ocultar el footer fijo para evitar conflictos en móviles */
    .footer.position-fixed {
        display: none !important;
    }
}

/* =======================
   Estilos específicos para ficha institucional
   Bordes suaves, sombra ligera y espaciado compacto
======================== */

/* =======================
    Estilos para Reportes
======================== */
.report-card {
     background: var(--white);
     padding: 20px;
     border-radius: 8px;
     box-shadow: 0 4px 6px rgba(0,0,0,0.06);
     transition: transform 0.2s ease, box-shadow 0.2s ease;
     display:flex;
     flex-direction:column;
     height:100%;
}
.report-card:hover{ transform: translateY(-5px); box-shadow: 0 8px 18px rgba(0,0,0,0.08); }
.report-card h5{ color: var(--primary-color); margin-bottom:10px; }
.report-card p{ color:#666; font-size:14px; flex:1 1 auto; }
.btn-report{ width:100%; background-color:var(--primary-color); border-color:var(--primary-color); margin-top:12px; align-self:stretch; }
.btn-report:hover{ background-color:#2a5c91; border-color:#2a5c91; }

/* Column wrappers used for ordering animation */
.report-col{ transition: opacity .25s ease, transform .25s ease; }
.sr-only{ position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;border:0!important }

/* Small helper for the reports header */
.reports-header h3{ color:var(--primary-color); margin:0 }

/* =======================
     Estilos para galería de uploads (miniaturas)
======================== */
.gallery-grid{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-start }
.gallery-item{ width:88px; height:66px; overflow:hidden; border:1px solid var(--border-color); border-radius:6px; background:#fff; display:flex; align-items:center; justify-content:center }
.gallery-item img{ width:100%; height:100%; object-fit:cover; display:block }
.gallery-item .filename{ display:block; font-size:11px; color:#666; text-align:center; margin-top:6px; max-width:88px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.gallery-controls{ display:flex; gap:8px; align-items:center; justify-content:flex-end; margin-bottom:8px }

@media (max-width:768px){
    .gallery-item{ width:72px; height:56px }
    .gallery-item .filename{ max-width:72px }
}

.ficha-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ficha-tab {
    padding: 8px 12px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(250,250,250,0.95));
    border: 1px solid rgba(0,0,0,0.06);
    color: var(--text-dark);
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.ficha-tab.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 6px 18px rgba(48,107,169,0.12);
}

.section-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* ======================
   Hero / Encabezados para fichas
   Mejora visual de encabezados en fichas y vistas asociadas
====================== */
.ficha-hero {
    background: linear-gradient(135deg, rgba(39,73,109,0.06), rgba(42,157,143,0.02));
    padding: 36px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 12px 36px rgba(16,38,74,0.06);
}
.ficha-hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}
.ficha-hero-title {
    font-size: 2.25rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.6px;
}
.ficha-hero-sub {
    color: #4b5d72;
    margin: 0;
    font-size: 1rem;
    max-width: 820px;
}
.ficha-hero-paciente {
    margin-top: 6px;
    font-weight: 600;
    color: #243b59;
}

/* Badge que muestra el ID del paciente junto al nombre */
.ficha-id-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    color: #243b59;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Hero refinado: fondo, padding y sombras suaves para un look profesional */
.ficha-hero {
    background: linear-gradient(135deg, rgba(48,107,169,0.08), rgba(225,109,43,0.03));
    padding: 36px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(16,38,74,0.06);
}

.profile-image-hero {
    width: 124px;
    height: 124px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.85);
    box-shadow: 0 8px 24px rgba(16,38,74,0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(240,240,240,0.6));
}

/* Placeholder avatar (iniciales) cuando no hay imagen */
.profile-image-hero.profile-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
}

/* Layout: imagen + texto en pantallas grandes, columna en pantallas pequeñas */
.ficha-hero-content {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    justify-content: center;
}
.ficha-hero-main { display: flex; flex-direction: column; align-items: center; gap: 6px; }

@media (min-width: 992px) {
    .ficha-hero-content { flex-direction: row; align-items: center; }
    .ficha-hero-main { align-items: flex-start; text-align: left; }
    .ficha-hero-title { text-align: left; }
    .ficha-hero-sub { text-align: left; }
    .section-actions { justify-content: flex-start; }
}

@media (max-width: 991px) {
    .ficha-hero-main { align-items: center; text-align: center; }
}

.ficha-hero .section-actions {
    margin-top: 14px;
    gap: 10px;
}

.ficha-hero .btn {
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
}

/* Ajuste para botones dentro del hero: que queden juntos y con separación estética */
.ficha-hero .section-actions a, .ficha-hero .section-actions button {
    margin-right: 8px;
}

/* Subtle divider below hero */
.ficha-hero-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,0.04), rgba(0,0,0,0.02));
    margin-top: 18px;
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* Summary box styling */
.summary-box {
    background: linear-gradient(180deg, rgba(48,107,169,0.04), rgba(255,255,255,0.6));
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(48,107,169,0.08);
    color: #244060;
    font-weight: 600;
}

.ficha-card {
    padding: 14px;
    border-radius: 12px;
    max-width: 1100px;
    margin: 0 auto 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.form-group.compact {
    margin-bottom: 12px;
}

/* Inputs con borde suave y sombra ligera */
input[type="text"], input[type="date"], input[type="number"], input[type="tel"], input[type="email"], select, textarea {
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(48,107,169,0.12);
}

.section-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.small-muted {
    color: #6c757d;
    font-size: 0.9rem;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.06);
    z-index: 1200;
}

.field-error {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* Estilos para la vista institucional por pestañas */
.tab-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.tab-btn {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}
.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 6px 18px rgba(48,107,169,0.12);
}
/* Solo pestañas personalizadas (.tab-form), no Bootstrap .tab-content */
.tab-form .tab-content { display: none; padding-top: 8px; }
.tab-form .tab-content.active { display: block; }

/* Entrada rápida de pacientes */
.quick-entry-page .qe-wizard-card { max-width: 1180px; margin: 0 auto; }
.quick-entry-page .nav-tabs { border-bottom: 2px solid #d4e4f4; gap: 2px; flex-wrap: wrap; }
.quick-entry-page .nav-tabs .nav-link {
    color: #4a6278;
    font-weight: 600;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.65rem 1rem;
    border-radius: 8px 8px 0 0;
}
.quick-entry-page .nav-tabs .nav-link:hover:not(.disabled) {
    background: #eef5fc;
    color: var(--primary-color);
}
.quick-entry-page .nav-tabs .nav-link.active {
    color: var(--primary-color);
    background: #fff;
    border-bottom-color: var(--primary-color);
}
.quick-entry-page .nav-tabs .nav-link.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.quick-entry-page .qe-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: #fafbfc;
}
.quick-entry-page .qe-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.quick-entry-page .qe-footer-bar {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    border-top: 2px solid var(--primary-color);
    padding: 14px 0 4px;
    margin-top: 1rem;
    box-shadow: 0 -6px 20px rgba(48, 107, 169, 0.1);
}
.quick-entry-page .qe-footer-bar .btn-create-main {
    font-weight: 700;
    padding: 0.6rem 1.5rem;
    font-size: 1.05rem;
}
.quick-entry-page #qe-patient-badge { display: none; }
.quick-entry-page.qe-created #qe-patient-badge { display: inline-flex; }
.quick-entry-page.qe-created .btn-create-main { display: none !important; }
.quick-entry-page .qe-step-label { font-size: 0.875rem; color: #5a6d7e; }
.quick-entry-page .tab-pane { padding-top: 0.5rem; }
.tab-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tab-form .form-group { display: flex; flex-direction: column; }
.tab-form .two-col .form-group { min-width: 0; }
.section-actions { margin-top: 14px; display:flex; align-items:center; }
.section-status span { color:#666; font-size:0.95rem; }

/* Indicador visual en pestañas (Bootstrap nav-tabs) para secciones completadas */
.nav-tabs .nav-link.complete {
    position: relative;
    color: var(--primary-color);
    font-weight: 700;
}
.nav-tabs .nav-link.complete::after {
    content: '\2713'; /* check */
    position: absolute;
    right: 8px;
    top: 6px;
    background: var(--success-color);
    color: #fff;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

@media (max-width: 768px) {
  .tab-form .form-grid { grid-template-columns: 1fr; }
  .tab-nav { justify-content: space-between; }
}

/* =======================
   Ajustes adicionales para fichas
   - Centrar encabezado en todas las vistas de ficha
   - Mejorar estilo y alineación de pestañas (nav-tabs)
   - Asegurar colores consistentes entre fichas
======================= */
.ficha-hero-inner { align-items: center; text-align: center; }
.ficha-hero-title { font-size: 2.1rem; letter-spacing: -0.6px; text-transform: none; }
.ficha-hero-sub { font-size: 1rem; color: #516777; }
.ficha-hero-paciente { font-size: 1rem; color: #243b59; }

/* Centrar la tarjeta de ficha y limitar ancho para mejor lectura */
.ficha-card { max-width: 1100px; margin-left: auto; margin-right: auto; }

/* Mejoras visuales para las pestañas (bootstrap nav-tabs) */
.ficha-card .nav-tabs {
    border-bottom: 0; /* eliminamos línea por defecto */
    justify-content: center; /* centramos las pestañas */
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(245,247,249,0.6));
    border-radius: 12px;
    margin-bottom: 18px;
}
.ficha-card .nav-tabs .nav-item { margin: 0; }
.ficha-card .nav-tabs .nav-link {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    padding: 10px 16px;
    color: var(--primary-color);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(16,38,74,0.04);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.ficha-card .nav-tabs .nav-link .bi { font-size: 1.1rem; color: inherit; }
.ficha-card .nav-tabs .nav-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(16,38,74,0.08);
    background: rgba(48,107,169,0.04);
}
.ficha-card .nav-tabs .nav-link.active {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    color: #fff !important;
    border-color: transparent;
    box-shadow: 0 10px 28px rgba(39,73,109,0.14);
    transform: translateY(-2px);
}

/* Colores por tipo de pestaña (clases específicas) */
.ficha-card .nav-link.tab-datos.active { background: linear-gradient(90deg, var(--primary-color), var(--primary-dark)); }
.ficha-card .nav-link.tab-contacto.active { background: linear-gradient(90deg, var(--primary-dark), #1f3b57); }
.ficha-card .nav-link.tab-antecedentes-personales.active { background: linear-gradient(90deg, var(--danger-color), #b02a37); }
.ficha-card .nav-link.tab-antecedentes-no-patologicos.active { background: linear-gradient(90deg, var(--accent-color), #d66a2a); }
.ficha-card .nav-link.tab-antecedentes-familiares.active { background: linear-gradient(90deg, var(--success-color), #1f8b74); }
.ficha-card .nav-link.tab-datos-clinicos.active { background: linear-gradient(90deg, #2b6ea3, var(--primary-dark)); }
.ficha-card .nav-link.tab-historia-clinica.active { background: linear-gradient(90deg, var(--accent-color), var(--primary-color)); }
.ficha-card .nav-link.tab-examen-fisico.active { background: linear-gradient(90deg, var(--success-color), #1f8b74); }
.ficha-card .nav-link.tab-gineco-obstetricos.active { background: linear-gradient(90deg, var(--primary-dark), var(--primary-color)); }
.ficha-card .nav-link.tab-historial.active { background: linear-gradient(90deg, var(--secondary-color), #d66a2a); }

/* Asegurar que los iconos sigan el color cuando la pestaña está activa */
.ficha-card .nav-link.active .bi { color: #fff; opacity: 0.95; }
.ficha-card .nav-link .bi { color: currentColor; opacity: 0.9; }

/* Esquema de colores para ficha institucional (coincide con ficha clínica) */
.ficha-institucional .ficha-hero { /* enfatizar el gradiente base */
    background: linear-gradient(135deg, rgba(48,107,169,0.10), rgba(225,109,43,0.04));
}

/* Section cards con marca de color arriba */
.ficha-institucional .section-card {
    border-top: 4px solid rgba(0,0,0,0.03);
    padding: 16px;
}
.ficha-institucional .section-card.blue { border-top-color: var(--primary-color); }
.ficha-institucional .section-card.orange { border-top-color: var(--accent-color); }
.ficha-institucional .section-card.green { border-top-color: var(--success-color); }

/* Badges y chips de color para consistencia visual */
.ficha-institucional .color-chip { display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:8px; vertical-align:middle; }
.ficha-institucional .color-chip.blue { background: var(--primary-color); }
.ficha-institucional .color-chip.orange { background: var(--accent-color); }
.ficha-institucional .color-chip.green { background: var(--success-color); }

/* Asegurar que los h3 dentro de fichas institucionales tengan una pequeña raya acorde al color de la sección si se marca */
.ficha-institucional h3.section-title-blue { color: var(--primary-color); border-left: 4px solid var(--primary-color); padding-left:10px; }
.ficha-institucional h3.section-title-orange { color: var(--accent-color); border-left: 4px solid var(--accent-color); padding-left:10px; }
.ficha-institucional h3.section-title-green { color: var(--success-color); border-left: 4px solid var(--success-color); padding-left:10px; }

/* Asegurar consistencia en botones dentro del hero */
.ficha-hero .btn-primary { background: var(--primary-color); border-color: transparent; }
.ficha-hero .btn-outline-secondary { border-radius: 8px; }

/* Galería de estudios: miniaturas compactas para evitar imágenes demasiado grandes */
.image-gallery { list-style: none; padding: 0; margin: 0; display:flex; gap:8px; flex-wrap:wrap; }
.image-gallery .image-item { width: 120px; display:flex; flex-direction:column; gap:6px; align-items:center; }
.image-gallery .image-item a { display:block; width:100%; height:90px; overflow:hidden; border-radius:8px; background:#fff; border:1px solid rgba(0,0,0,0.04); display:flex; align-items:center; justify-content:center; }
.image-gallery .image-item img { width:100%; height:100%; object-fit:cover; display:block; }
.image-gallery .image-item .pdf-thumbnail { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:20px; color:#555; }
.image-item-label { font-size:0.78rem; color:#333; text-align:center; word-break:break-word; }

@media (max-width: 768px) {
    .image-gallery .image-item { width: 46%; }
}

/* Pequeños ajustes responsive para pestañas */
@media (max-width: 768px) {
    .ficha-card .nav-tabs { justify-content: flex-start; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
    .ficha-hero-inner { padding-left: 12px; padding-right: 12px; }
}

/* Modales por encima del sidebar fijo (sidebar z-index: 1040) */
.modal-backdrop { z-index: 1055 !important; }
.modal { z-index: 1060 !important; }

/* Estilos para el modal elegante de creación/edición de paciente */
.modal .modal-header.bg-gradient-primary {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}
.modal .modal-body { background: linear-gradient(180deg, #ffffff, #fbfdff); }
.modal .modal-footer { background: transparent; border-top: 1px solid rgba(0,0,0,0.04); }
.modal .modal-title { color: #fff; }
.btn-outline-secondary { border: 1px solid rgba(0,0,0,0.06); color: #333; }
.btn-close-white { filter: invert(1) brightness(1.2); }

@media (max-width: 768px) {
    .modal-dialog.modal-xl { max-width: 92%; }
}

/* =======================
   Dashboard
======================== */
.dashboard-page .page-title-main {
    color: #244f7f;
    font-weight: 800;
    margin: 0;
}

.dashboard-page .summary-cards .card {
    border: 1px solid #e4ebf5;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f7faff 100%);
    box-shadow: 0 8px 22px rgba(20, 42, 80, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dashboard-page .summary-cards .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(20, 42, 80, 0.12);
}

.dashboard-page .metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e9f1fc;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.dashboard-page .metric-title {
    color: #6a7a8d;
    font-size: 0.9rem;
}

.dashboard-page .metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: #243f5c;
    line-height: 1;
}

.dashboard-page .chart-panel,
.dashboard-page .activity-panel {
    background: #fff;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e6edf7;
}

.dashboard-page .consult-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-page .consult-item {
    border: 1px solid #e6edf7;
    border-radius: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    display: flex;
    gap: 12px;
}

.dashboard-page .quick-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 128px;
    padding: 16px 14px;
    border-radius: 14px;
    text-decoration: none;
    border: 1px solid #e2eaf5;
    background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 6px 18px rgba(17, 45, 79, 0.08);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    font-weight: 700;
    color: #1a4d86;
}

.dashboard-page .quick-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(17, 45, 79, 0.14);
    color: #1a4d86;
}

.dashboard-page .dashboard-search-wrap {
    position: relative;
    min-width: 280px;
    max-width: 360px;
    flex: 1 1 280px;
}

.dashboard-page .dashboard-search-results {
    position: absolute;
    z-index: 2000;
    left: 0;
    right: 0;
    display: none;
    max-height: 320px;
    overflow: auto;
    margin-top: 6px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* =======================
   Consultas (listado / formulario)
======================== */
.consultas-page .page-header {
    background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
    border: 1px solid #e7ecf3;
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: 0 6px 20px rgba(20, 42, 80, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.consultas-page .page-header h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.consultas-page .header-subtitle {
    color: #627389;
    font-size: 0.95rem;
    margin-top: 4px;
}

.consultas-page .btn-new {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border: 1px solid var(--primary-color);
}

.consultas-page .btn-new:hover {
    background: var(--primary-dark);
    color: #fff;
}

.consultas-page .search-form {
    background: #fff;
    border: 1px solid #e7ecf3;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(18, 43, 77, 0.05);
}

.consultas-page .table-wrap {
    background: #fff;
    border: 1px solid #e7ecf3;
    border-radius: 14px;
    overflow: auto;
    box-shadow: 0 6px 20px rgba(19, 42, 77, 0.05);
}

.consultas-page .consultas-table th {
    background: linear-gradient(180deg, #f4f8ff 0%, #eaf2fc 100%);
    color: var(--primary-color);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.consultas-page .consultas-table tbody tr:hover {
    background: #f9fbff;
}

.consultas-page .btn-edit,
.consultas-page .btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.86rem;
    text-decoration: none;
}

.consultas-page .btn-edit {
    background: linear-gradient(180deg, #fff8db 0%, #ffefbd 100%);
    border: 1px solid #f6df95;
    color: #6e5600;
}

.consultas-page .btn-delete {
    background: linear-gradient(180deg, #fde7ea 0%, #f9d4da 100%);
    border: 1px solid #efb7bf;
    color: #7d1f2a;
}

.consultas-page .success-box {
    background: #e8f7ed;
    color: #2d7a2d;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid #bfe6cb;
}

/* =======================
   Reportes (vistas de detalle vía ReportsController)
======================== */
.report-detail-page .page-hero {
    background: linear-gradient(145deg, #ffffff 0%, #f5f9ff 100%);
    border: 1px solid #e3eaf4;
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: 0 8px 22px rgba(17, 45, 79, 0.08);
}

.report-detail-page .page-hero h1 {
    margin: 0;
    color: #2b5f95;
    font-size: 1.5rem;
    font-weight: 700;
}

.report-detail-page .filter-card {
    border: 1px solid #e5edf6;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(17, 45, 79, 0.06);
}

.report-detail-page .table thead th {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 0.85rem;
    border: none;
}

.reports-page .reports-hero {
    background: linear-gradient(145deg, #ffffff 0%, #f5f9ff 100%);
    border: 1px solid #e3eaf4;
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 22px rgba(17, 45, 79, 0.08);
}

.reports-page .reports-hero h3 {
    margin: 0;
    color: #2b5f95;
    font-weight: 700;
}

.reports-page .side-section-title {
    color: var(--primary-color);
    font-weight: 700;
}

.reports-page .side-section-desc {
    color: #7a8ea3;
    font-size: 0.88rem;
}

.reports-page .reports-header {
    background: #fff;
    border: 1px solid #e5edf6;
    border-radius: 12px;
}

/* Dashboard — metricas y accesos con color */
.dashboard-page .metric-card-pacientes .metric-icon { background: #dcecff; color: #2f6eb5; }
.dashboard-page .metric-card-citas-hoy .metric-icon { background: #fff0d6; color: #c27a0d; }
.dashboard-page .metric-card-realizadas .metric-icon { background: #dff5ec; color: #248a55; }
.dashboard-page .metric-card-consultas .metric-icon { background: #e5f4ff; color: #1f7f92; }

.dashboard-page .metric-card-pacientes { border-top: 4px solid #4a8fd4; }
.dashboard-page .metric-card-citas-hoy { border-top: 4px solid #e8a43b; }
.dashboard-page .metric-card-realizadas { border-top: 4px solid #3cb58a; }
.dashboard-page .metric-card-consultas { border-top: 4px solid #5bb8cf; }

.dashboard-page .quick-tile i {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.dashboard-page .quick-tile-1 {
    background: linear-gradient(155deg, #e8f2ff 0%, #c5ddff 100%);
    border-color: #9ec4f5;
    color: #1a5088;
}
.dashboard-page .quick-tile-1 i { background: #fff; color: #2f6eb5; }

.dashboard-page .quick-tile-2 {
    background: linear-gradient(155deg, #fff3df 0%, #ffd9a8 100%);
    border-color: #efc06d;
    color: #7a4e08;
}
.dashboard-page .quick-tile-2 i { background: #fff; color: #d68910; }

.dashboard-page .quick-tile-3 {
    background: linear-gradient(155deg, #e3f9ef 0%, #b8efd4 100%);
    border-color: #8fd9b5;
    color: #1d6b45;
}
.dashboard-page .quick-tile-3 i { background: #fff; color: #2a9d6a; }

.dashboard-page .quick-tile-4 {
    background: linear-gradient(155deg, #efe8ff 0%, #d4c4ff 100%);
    border-color: #b9a2ef;
    color: #4a3d87;
}
.dashboard-page .quick-tile-4 i { background: #fff; color: #6b56c8; }

.dashboard-page .charts-row { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }
@media (max-width: 991px) { .dashboard-page .charts-row { grid-template-columns: 1fr; } }

/* Reportes — accesos rapidos con filtros */
.reports-page .quick-reports {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.reports-page .quick-report-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    text-decoration: none;
    border: 1px solid #dbe7f5;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #2a4f73;
}

.reports-page .quick-report-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(45, 90, 140, 0.14);
    color: #1e3f62;
}

.reports-page .quick-report-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.reports-page .quick-report-link.qr-today .quick-report-icon { background: #fff2d9; color: #c27a0d; }
.reports-page .quick-report-link.qr-week .quick-report-icon { background: #e8f2ff; color: #2f6eb5; }
.reports-page .quick-report-link.qr-month .quick-report-icon { background: #e5f4ff; color: #1f7f92; }
.reports-page .quick-report-link.qr-pending .quick-report-icon { background: #ffe8cc; color: #b35c00; }
.reports-page .quick-report-link.qr-cancel .quick-report-icon { background: #fde8ea; color: #b02a37; }
.reports-page .quick-report-link.qr-cost .quick-report-icon { background: #e8f7ef; color: #248a55; }

.reports-page .report-card .card-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e9f2ff;
    color: var(--primary-color);
    margin-right: 8px;
}

.reports-page .btn-report {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 14px;
}

/* Consultas — botones elegantes */
.consultas-page .toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.consultas-page .btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.consultas-page .btn-icon:hover { transform: translateY(-2px); }

.consultas-page .btn-icon-primary {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(61, 122, 184, 0.28);
}

.consultas-page .btn-icon-outline {
    background: #fff;
    color: var(--primary-color);
    border: 1px solid #c5d9ef;
}

.consultas-page .btn-icon-report {
    background: linear-gradient(180deg, #5bb8cf, #3a94ad);
    color: #fff;
    box-shadow: 0 6px 16px rgba(58, 148, 173, 0.25);
}

.consultas-page .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.consultas-page .btn-action i {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.consultas-page .btn-action span {
    white-space: nowrap;
}

.consultas-page a.btn-icon,
.consultas-page a.btn-action {
    text-decoration: none;
}

.consultas-page .btn-action-edit {
    background: #fffbeb;
    border-color: #f0dfa0;
    color: #7a5e00;
}
.consultas-page .btn-action-edit i { background: #ffe999; color: #8a6b00; }

.consultas-page .btn-action-delete {
    background: #fff5f6;
    border-color: #f0c4ca;
    color: #8b2430;
}
.consultas-page .btn-action-delete i { background: #ffd4da; color: #a12836; }

.consultas-page .btn-action-ficha {
    background: #eef6ff;
    border-color: #c5d9ef;
    color: #2a5580;
}
.consultas-page .btn-action-ficha i { background: #d6e8ff; color: #2f6eb5; }

.consultas-page .stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.consultas-page .stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #dbe7f5;
    font-size: 0.88rem;
    font-weight: 600;
    color: #3d5f82;
}

/* Calendario — estados y alertas */
.calendar-page .calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #dbe7f5;
}

.calendar-page .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4a6278;
}

.calendar-page .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.calendar-page .cita-item.status-proxima {
    background: #fff8e6;
    border-left: 4px solid #e8a43b;
    animation: cal-pulse-soft 2s ease-in-out infinite;
}

.calendar-page .cita-item.status-urgente {
    background: #ffe8e0;
    border-left: 4px solid #e85d2a;
    box-shadow: 0 0 0 2px rgba(232, 93, 42, 0.2);
    animation: cal-pulse-urgent 1.2s ease-in-out infinite;
}

.calendar-page .cita-item.status-vencida {
    background: #f3e8ff;
    border-left: 4px solid #8b5cf6;
    opacity: 0.9;
}

.calendar-page .cita-item.status-reprogramada {
    background: #e8f4ff;
    border-left: 4px solid #3b82f6;
    border-style: dashed;
}

.calendar-page .cita-item.status-cancelada {
    background: #fde8ea;
    border-left: 4px solid #dc3545;
    text-decoration: line-through;
    opacity: 0.85;
}

.calendar-page .cita-item.status-realizada {
    background: #e8f7ef;
    border-left: 4px solid #28a745;
}

.calendar-page .cita-item.status-pendiente {
    background: #eef5fc;
    border-left: 4px solid var(--primary-color);
}

.calendar-page .cita-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 4px;
    vertical-align: middle;
}

.calendar-page .badge-urgente { background: #e85d2a; color: #fff; }
.calendar-page .badge-proxima { background: #e8a43b; color: #fff; }
.calendar-page .badge-reprog { background: #3b82f6; color: #fff; }
.calendar-page .badge-cancel { background: #dc3545; color: #fff; }

@keyframes cal-pulse-soft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 164, 59, 0); }
    50% { box-shadow: 0 0 0 4px rgba(232, 164, 59, 0.25); }
}

@keyframes cal-pulse-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 42, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(232, 93, 42, 0.15); }
}

.calendar-page .day-box.has-urgent {
    outline: 2px solid rgba(232, 93, 42, 0.45);
    outline-offset: -2px;
}

/* =======================
   Consultas — refuerzo (evita conflictos Bootstrap/global)
======================== */
.consultas-page .content-shell {
    max-width: 1480px;
    margin: 0 auto;
}

.consultas-page .search-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

.consultas-page .search-form .form-control {
    flex: 1 1 280px;
    min-width: 200px;
    width: auto;
    max-width: 100%;
}

.consultas-page .search-form .input-group-text {
    border-radius: 10px 0 0 10px;
    background: #f4f8ff;
    border-color: #c5d9ef;
    color: var(--primary-color);
}

.consultas-page .consultas-table thead th {
    background: linear-gradient(180deg, #e8f2fc 0%, #d6e8ff 100%) !important;
    color: #2a5580 !important;
    border-bottom: 2px solid #b8d4f0 !important;
    font-weight: 700;
    white-space: nowrap;
}

.consultas-page .consultas-table td {
    vertical-align: middle;
    border-color: #e8eef5;
}

.consultas-page .actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
}

.consultas-page td.actions {
    white-space: nowrap;
    width: 1%;
    min-width: 200px;
}

.consultas-page .btn-action {
    padding: 6px 10px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.consultas-page .btn-action i {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
}

.consultas-page .btn-icon,
.consultas-page .btn-action {
    box-sizing: border-box;
}

.consultas-page .btn-icon:not(.border-0) {
    cursor: pointer;
}

/* =======================
   Reportes — pestañas e iconos
======================== */
.reports-page .reports-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    background: #fff;
    border: 1px solid #dbe7f5;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(36, 72, 110, 0.06);
}

.reports-page .reports-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #4a6278;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reports-page .reports-tab-btn i {
    font-size: 1.1rem;
}

.reports-page .reports-tab-btn:hover {
    background: #eef5fc;
    color: var(--primary-color);
}

.reports-page .reports-tab-btn.active {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(61, 122, 184, 0.3);
}

.reports-page .reports-tab-btn.active i {
    color: #ffe8c8;
}

.reports-page .reports-tab-panel {
    display: none;
    animation: fadeTab 0.25s ease;
}

.reports-page .reports-tab-panel.active {
    display: block;
}

@keyframes fadeTab {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.reports-page .report-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.reports-page .report-icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 20px 14px 16px;
    border-radius: 16px;
    text-decoration: none;
    border: 1px solid #dbe7f5;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #2a4f73;
    min-height: 148px;
    justify-content: flex-start;
}

.reports-page .report-icon-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(45, 90, 140, 0.16);
    color: #1e3f62;
}

.reports-page .report-icon-tile .tile-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
}

.reports-page .report-icon-tile .tile-label {
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.25;
}

.reports-page .report-icon-tile .tile-hint {
    font-size: 0.75rem;
    color: #6a8499;
    line-height: 1.3;
}

.reports-page .tile-blue .tile-icon { background: #e8f2ff; color: #2f6eb5; }
.reports-page .tile-teal .tile-icon { background: #e0f7f4; color: #1a8f7a; }
.reports-page .tile-orange .tile-icon { background: #fff2df; color: #c27a0d; }
.reports-page .tile-red .tile-icon { background: #fde8ea; color: #b02a37; }
.reports-page .tile-purple .tile-icon { background: #efe8ff; color: #6b56c8; }
.reports-page .tile-green .tile-icon { background: #e8f7ef; color: #248a55; }
.reports-page .tile-slate .tile-icon { background: #eef2f7; color: #4a6278; }

.reports-page .tab-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #4a6a8a;
    margin-bottom: 12px;
}
