.body {
    background-image: url(../../img/Background.jfif);
    background-size: cover;
}

.login-container {
    width: 500px;
    padding: 85px;
    border-radius: 12px;
    margin: 110px auto 0 auto; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-container label {
    display: block;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    margin-top: 10px;
    margin-bottom: 5px;
    width: 100%;
}

.login-container input {
    display: block;
    width: 100%;
    height: 30px;
    box-sizing: border-box; 
    margin-bottom: 10px;
}

.title-button {
    width: 100%; 
    height: 35px;
    background-color: var(--cs-navy-700);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

header {
    width: 100%;
    padding: 15px 40px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px; 
}

header h1 {
    margin: 0;
    font-size: 20px; /* Altura del texto */
    font-weight: bold;
    color: var(--cs-navy-700);
    letter-spacing: 0.5px;
    line-height: 1; /* Elimina espacio sobrante arriba y abajo del texto */
}

.header-logo {
    height: 50px; /* Mismo tamaño que el font-size del h1 */
    width: auto;  /* Mantiene la proporción de la imagen */
    object-fit: contain;
    mix-blend-mode: multiply;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: inherit;
}

body {
    background-color: #f4f6f9;
    color: #333;
}

/* Header */
.app-header {
    width: 100%;
    padding: 12px 30px;
    background-color: #ffffff;
    border-bottom: 1px solid #dcdcdc;
    display: flex;
    justify-content: flex-end;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    height: 22px;
    width: auto;
}

.app-header h1 {
    font-size: 16px;
    color: var(--cs-navy-700);
    text-transform: uppercase;
}

/* Layout General */
.app-layout {
    display: flex;
    gap: 18px;

    width: 100%;
    max-width: 2000px;

    margin: 0 auto;
    padding: 15px 30px;
}

/* Sidebar */
.sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-box {
    border: 1px solid var(--cs-navy-700);
    border-radius: 4px;
    background-color: #fff;
    overflow: hidden;
}

.box-header {
    background-color: var(--cs-navy-700);
    color: white;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-link {
    color: var(--cs-navy-700);
    text-decoration: underline;

}

.profile-content {
    padding: 12px;
    text-align: center;
    background-color: var(--cs-navy);
    color: white;
}

.profile-avatar {
    width: 90px;
    height: 81px;
    border-radius: 50%;
    border: 2px solid white;
    background-color: white;
    margin-bottom: 8px
}

.user-name {
    font-size: 10px;
    font-weight: bold;
}

.user-email {
    font-size: 8px;
    word-break: break-all;
    margin: 4px 0;
}

.user-center {
    font-size: 8px;
    font-weight: bold;
    opacity: 0.9;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    padding: 5px 10px;
    font-size: 9px;
    color: var(--cs-navy-700);
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: #e8f0fe;
    font-weight: bold;
}

.info-content {
    padding: 10px;
    font-size: 12px;
    text-align: center;
    color: #555;
}

/* Area Principal */
.main-content {
    flex-grow: 1;
}

.card-module {
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 4px;
}

.margin-top {
    margin-top: 15px;
}

/* Tabs */
.module-tabs {
    display: flex;
    background-color: #f1f1f1;
    border-bottom: 1px solid #ccc;
}

.tab-btn {

    background: #e4e4e4;
    border: none;
    border-right: 1px solid #ccc;

    color: var(--cs-navy-700);
    cursor: pointer;
}

.tab-btn.active {
    background-color: var(--cs-navy-700);
    color: white;
}

/* Formulario */
.module-body {
    padding: 12px;
    background-color: #f9f9f9;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    align-items: center;
}

.field-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.field-group label {

    font-weight: bold;
    color: var(--cs-navy-700);
    white-space: nowrap;
}

.field-group input {

    border: 1px solid #aaa;

}

.actions-group {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.btn-primary, .btn-secondary, .btn-danger {

    border: none;

    cursor: pointer;
}

.btn-primary { background-color: var(--cs-navy-700); color: white; }
.btn-secondary { background-color: var(--cs-navy-700); color: white; }
.btn-danger { background-color: #d9534f; color: white; }

/* Estadísticas */
.stats-bar {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #ccc;
    font-size: 9px;
    color: var(--cs-navy-700);
}

.stats-title { font-weight: bold; }

/* Barra Pacientes con turno */
.module-bar {
    background-color: var(--cs-navy-700);
    color: white;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bar-left, .bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
}

.bar-title { font-weight: bold; }

.date-picker, .select-sort {

    border: 1px solid #ccc;

}

/* Tabla */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;

}

.data-table th {
    background-color: #f1f1f1;
    color: #333;
    text-align: left;
    padding: 6px;
    border-bottom: 1px solid #ccc;
}

.data-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
}

.empty-row {
    text-align: center;
    color: #777;
    padding: 15px !important;
}

/* =========================================
   FICHA DEL PACIENTE
   ========================================= */

#fichaPaciente {
    width: 100%;
    margin-top: 15px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Cabecera de la ficha */

#fichaPaciente .patient-header {
    padding: 20px 25px;
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
}

#fichaPaciente .patient-header h2 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: bold;
    color: var(--cs-navy-700);
}

#fichaPaciente .patient-header span {
    font-size: 10px;
    color: #666;
}

/* Cuerpo */

#fichaPaciente .module-body {
    padding: 20px;
    background-color: #f9f9f9;
}

/* Datos del paciente */

#fichaPaciente .patient-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    padding: 0;
}

/* Campos */

#fichaPaciente .patient-data .field-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
    min-height: 65px;
    padding: 12px 15px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Etiquetas */

#fichaPaciente .patient-data .field-group label {
    display: block;

    margin: 0;

    font-weight: bold;

    color: var(--cs-navy-700);
}

/* Valores */

#fichaPaciente .patient-data .field-group span {
    display: block;

    width: 100%;

    font-size: 11px;

    color: #333;
}

/* Botones */

#fichaPaciente .patient-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    gap: 10px;

    padding-top: 20px;
}

/* Responsive */

@media (max-width: 800px) {

    #fichaPaciente .patient-data {
        grid-template-columns: 1fr;
    }

}

/* =========================================
   HISTORIA MÉDICA
   ========================================= */

.medical-history {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* Encabezado de la sección */
.medical-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--cs-navy-700);
}

.medical-history-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--cs-navy-700);
}

/* Contenedor de las historias */
.medical-history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Cada historia médica */
.medical-history-record {
    background-color: #ffffff;
    border: 1px solid #d8d8d8;
    border-left: 4px solid var(--cs-navy-700);
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Cabecera de cada historia */
.medical-history-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    margin-bottom: 15px;
    padding-bottom: 10px;

    border-bottom: 1px solid #eeeeee;
}

.medical-history-record-header strong {
    font-size: 12px;
    color: var(--cs-navy-700);
}

.medical-history-record-header span {
    font-size: 10px;
    color: #777;
}

/* Campos de la historia */
.medical-history-field {
    margin-bottom: 12px;
}

.medical-history-field strong {
    display: block;
    margin-bottom: 4px;

    font-size: 10px;
    color: var(--cs-navy-700);
}

.medical-history-field p {
    margin: 0;

    font-size: 11px;
    line-height: 1.5;
    color: #444;

    white-space: pre-wrap;
}

/* Estado de la historia */
.medical-history-status {
    margin-top: 15px;
    padding-top: 10px;

    border-top: 1px dashed #ddd;

    font-size: 10px;
    font-weight: bold;
    color: #666;
}

/* Mensaje cuando no hay historias */
.medical-history-list .empty-row {
    padding: 20px;

    text-align: center;

    color: #777;
    font-size: 11px;

    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
}

/* Adaptación para pantallas pequeñas */
@media (max-width: 800px) {

    .medical-history-record-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .medical-history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

}

/* =========================================
   FORMULARIO NUEVA HISTORIA MÉDICA
   ========================================= */

.new-medical-history-form {
    margin-top: 15px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
}

.new-medical-history-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.new-medical-history-header h4 {
    margin: 0;
    color: var(--cs-navy-700);
    font-size: 15px;
}

/* =========================================
   CAMPOS
   ========================================= */

.new-medical-history-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.medical-history-input-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.medical-history-input-group label {

    font-weight: bold;
    color: var(--cs-navy-700);
}

/* =========================================
   TEXTAREAS
   ========================================= */

.medical-history-input-group textarea {
    width: 100%;

    box-sizing: border-box;

    border: 1px solid #cfcfcf;

    background-color: #fff;

    resize: vertical;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

/* Cuando hacemos click dentro */

.medical-history-input-group textarea:focus {

    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.10);
}

/* Placeholder */

.medical-history-input-group textarea::placeholder {

    color: #999;

}

/* =========================================
   BOTONES
   ========================================= */

.new-medical-history-actions {

    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 20px;

    padding-top: 15px;

    border-top: 1px solid #ddd;
}

/* =========================================
   MODAL ASIGNAR MÉDICO
   ========================================= */

.modal-medico {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.55);

    z-index: 1000;

    align-items: center;
    justify-content: center;
}

/* Ventana del modal */

.modal-medico-content {

    width: 90%;
    max-width: 500px;

    background: #ffffff;

    border-radius: 12px;

    padding: 0;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.25);

    overflow: hidden;
}

/* Encabezado */

.modal-medico-header {

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 16px 20px;

    background: #1f497d;

    color: white;
}

.modal-medico-header h3 {

    margin: 0;

    font-size: 18px;

}

/* Botón X */

.modal-medico-close {

    border: none;

    background: transparent;

    color: white;

    font-size: 26px;

    line-height: 1;

    cursor: pointer;

    padding: 0;

}

.modal-medico-close:hover {

    opacity: 0.75;

}

/* Lista de médicos */

.lista-medicos-disponibles {

    padding: 20px;

    max-height: 400px;

    overflow-y: auto;

}

/* Cada médico */

.medico-disponible {

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 14px;

    margin-bottom: 10px;

    border: 1px solid #ddd;

    border-radius: 8px;

    background: #f8f9fa;
}

/* Información del médico */

.medico-disponible-info {

    display: flex;

    flex-direction: column;

    gap: 4px;

}

.medico-disponible-info strong {

    font-size: 14px;

    color: #333;

}

.medico-disponible-info span {

    font-size: 12px;

    color: #666;

}

/* Botón asignar */

.btn-asignar-medico {
    border: none;

    background: #1f497d;
    color: white;
    cursor: pointer;

}

.btn-asignar-medico:hover {

    background: #16365c;

}

/* =========================================
   ACCIONES - BÚSQUEDA DE PACIENTES
   ========================================= */

.select-accion-paciente {
    min-width: 145px;
    height: 34px;

    padding: 4px 30px 4px 10px;

    border: 1px solid var(--cs-navy-700);
    border-radius: 4px;

    background-color: var(--cs-navy-700);
    color: #ffffff;

    font-family: inherit;
    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.select-accion-paciente:hover {
    background-color: var(--cs-navy-700);
    border-color: var(--cs-navy-700);
}

.select-accion-paciente:focus {
    outline: none;

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.20);
}

.select-accion-paciente option {
    background-color: #ffffff;
    color: var(--cs-navy-700);
    font-weight: 500;
}

/* =========================================
   ASIGNACIÓN DE MÉDICO
   ========================================= */

#gestionAsignacionMedico {
    width: 100%;
    margin-top: 15px;

    background-color: #ffffff;

    border: 1px solid #d7dce2;
    border-radius: 6px;

    overflow: hidden;
}

/* =========================================
   CUERPO
   ========================================= */

#gestionAsignacionMedico .module-body {
    padding: 24px;

    background-color: #f8f9fb;
}

/* =========================================
   DATOS DEL PACIENTE
   ========================================= */

#asignacionNombrePaciente {
    margin: 0 0 4px 0;

    font-size: 22px;
    font-weight: 700;

    color: var(--cs-navy-700);
}

#asignacionDatosPaciente {
    display: block;

    margin-bottom: 18px;

    font-size: 11px;
    color: #6b7280;
}

/* =========================================
   ESTADO DE ASIGNACIÓN
   ========================================= */

.asignacion-estado {
    margin-bottom: 20px;

    padding: 10px 14px;

    background-color: #eef3f8;

    border-left: 4px solid var(--cs-navy-700);
    border-radius: 4px;

    font-size: 11px;
    color: #333;
}

.asignacion-estado strong {
    color: var(--cs-navy-700);
}

/* =========================================
   MÉDICO ACTUAL
   ========================================= */

.medico-actual-card {
    margin-bottom: 20px;

    padding: 18px;

    background-color: #ffffff;

    border: 1px solid #d9dee5;
    border-radius: 6px;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.04);
}

.medico-actual-card h3 {
    margin: 0 0 15px 0;

    padding-bottom: 8px;

    border-bottom: 1px solid var(--cs-line);

    font-size: 13px;
    color: var(--cs-navy-700);
}

.medico-actual-info {
    display: flex;
    flex-direction: column;

    gap: 5px;

    margin-bottom: 16px;
}

.medico-actual-info strong {
    font-size: 15px;
    color: #333;
}

.medico-actual-info span {
    font-size: 11px;
    color: #666;
}

/* =========================================
   BÚSQUEDA DE MÉDICOS
   ========================================= */

.asignacion-busqueda {
    margin-top: 5px;
}

.asignacion-busqueda h3 {
    margin: 0 0 15px 0;

    padding-bottom: 8px;

    border-bottom: 2px solid var(--cs-navy-700);

    font-size: 15px;
    color: var(--cs-navy-700);
}

/* Filtros */

.asignacion-filtros {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(220px, 1fr));

    gap: 16px;

    margin-bottom: 12px;
}

.asignacion-filtros .field-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 6px;
}

.asignacion-filtros .field-group label {

    font-weight: bold;

    color: var(--cs-navy-700);
}

.asignacion-filtros .field-group input {
    width: 100%;

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.asignacion-filtros .field-group input:focus {
    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.10);
}

/* =========================================
   BOTONES DE LOS FILTROS
   ========================================= */

.asignacion-acciones {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-bottom: 20px;
    min-height: 44px;
}

/* =========================================
   TABLA DE MÉDICOS
   ========================================= */

#gestionAsignacionMedico .table-container {
    overflow-x: auto;

    background-color: #ffffff;

    border: 1px solid #d9dee5;
    border-radius: 5px;
}

#gestionAsignacionMedico .data-table {
    width: 100%;

    border-collapse: collapse;

}

#gestionAsignacionMedico .data-table th {
    padding: 10px 12px;

    background-color: #eef1f5;

    color: var(--cs-navy-700);

    font-weight: bold;

    border-bottom: 1px solid #d7dce2;
}

#gestionAsignacionMedico .data-table td {
    padding: 10px 12px;

    vertical-align: middle;

    border-bottom: 1px solid #eeeeee;
}

#gestionAsignacionMedico .data-table tbody tr:last-child td {
    border-bottom: none;
}

#gestionAsignacionMedico .data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* =========================================
   BOTÓN ASIGNAR
   ========================================= */

#gestionAsignacionMedico .btn-asignar-medico {

    border: none;

    background-color: var(--cs-navy-700);
    color: #ffffff;

    cursor: pointer;
}

#gestionAsignacionMedico .btn-asignar-medico:hover {
    background-color: var(--cs-navy-700);
}

/* =========================================
   PIE / VOLVER
   ========================================= */

.asignacion-footer {
    display: flex;

    justify-content: flex-start;

    margin-top: 20px;
    padding-top: 15px;

    border-top: 1px solid #e1e4e8;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 800px) {

    #gestionAsignacionMedico .module-body {
        padding: 16px;
    }

    .asignacion-filtros {
        grid-template-columns: 1fr;
    }

    .asignacion-acciones {
        justify-content: flex-start;
    }

}

/* =========================================
   MÉDICO ACTUAL - AJUSTE FINAL
   ========================================= */

.medico-actual-card {
    position: relative;
}

.medico-actual-info {
    padding-right: 150px;
}

#btnLiberarPaciente {
    position: absolute;

    right: 18px;
    bottom: 18px;

    background-color: #ffffff;
    color: #b33a3a;

    border: 1px solid #d7a3a3;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#btnLiberarPaciente:hover {
    background-color: #fff3f3;
    border-color: #b33a3a;
}

@media (max-width: 600px) {

    .medico-actual-info {
        padding-right: 0;
    }

    #btnLiberarPaciente {
        position: static;
        margin-top: 12px;
    }

}

.medical-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-edit-history {

    border: 1px solid var(--cs-navy-700);

    background: #ffffff;
    color: var(--cs-navy-700);

    cursor: pointer;
}

.btn-edit-history:hover {
    background: var(--cs-navy-700);
    color: #ffffff;
}

.medical-history-edit-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 5px;
}

.medical-history-edit-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.medical-history-edit-field label {

    font-weight: 600;
    color: var(--cs-navy-700);
}

.medical-history-edit-field textarea {
    width: 100%;

    border: 1px solid #d4d8dd;

    resize: vertical;
    box-sizing: border-box;
}

.medical-history-edit-field textarea:focus {
    outline: none;
    border-color: var(--cs-navy-700);
}

.medical-history-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 5px;
}

.btn-save-history {

    border: none;

    background: var(--cs-navy-700);
    color: #ffffff;

    cursor: pointer;
}

.btn-cancel-edit-history {

    border: 1px solid #bfc5cc;

    background: #ffffff;
    color: #444444;

    cursor: pointer;
}

/* =========================================
   FICHA DEL PACIENTE - DISEÑO FINAL
   ========================================= */

/* Cabecera general */

#fichaPaciente .patient-header {
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e5e9;
}

#fichaPaciente .patient-header h2 {
    margin: 0 0 3px 0;
    font-size: 16px;
    color: var(--cs-navy-700);
}

#fichaPaciente .patient-header span {
    font-size: 9px;
    color: #777;
}

/* Cuerpo */

#fichaPaciente .module-body {
    padding: 14px;
}

/* =========================================
   DISTRIBUCIÓN PRINCIPAL
   ========================================= */

.patient-clinical-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 48%)
        minmax(0, 52%);

    gap: 20px;

    align-items: start;
}

/* =========================================
   COLUMNA DATOS DEL PACIENTE
   ========================================= */

.patient-info-column {
    min-width: 0;
}

/* Grilla */

#fichaPaciente .patient-data {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    column-gap: 20px;
    row-gap: 0;

    width: 100%;
}

/* =========================================
   CAMPOS
   ========================================= */

#fichaPaciente .patient-data .field-group {
    display: flex;

    flex-direction: column;
    align-items: flex-start;

    width: 100%;

    min-height: 48px;

    padding: 7px 4px;

    gap: 3px;

    background: transparent;

    border: none;
    border-bottom: 1px solid #e1e4e8;

    border-radius: 0;
}

/* Etiqueta */

#fichaPaciente .patient-data .field-group label {
    margin: 0;

    font-weight: bold;

    color: var(--cs-navy-700);
}

/* Valor */

#fichaPaciente .patient-data .field-group span {
    display: block;

    width: 100%;

    font-size: 14px;
    line-height: 1.5;

    color: #333;

    overflow-wrap: anywhere;
}

/* =========================================
   COLUMNA HISTORIA
   ========================================= */

.patient-history-column {
    min-width: 0;
}

.patient-history-column .medical-history {
    margin-top: 0;
    padding-top: 0;

    border-top: none;
}

.patient-history-column .medical-history-header {
    height: auto;

    margin: 0 0 10px 0;
    padding: 0 0 7px 0;

    border-bottom: 2px solid var(--cs-navy-700);
}

.patient-history-column .medical-history-header h3 {
    margin: 0;

    font-size: 14px;

    color: var(--cs-navy-700);
}

/* =========================================
   EVOLUCIONES MÁS COMPACTAS
   ========================================= */

.patient-history-column .medical-history-list {
    gap: 8px;
}

.patient-history-column .medical-history-record {
    padding: 10px 12px;

    border-radius: 4px;

    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04);
}

.patient-history-column
.medical-history-record-header {
    margin-bottom: 8px;

    padding-bottom: 7px;
}

.patient-history-column
.medical-history-record-header strong {
    font-size: 10px;
}

.patient-history-column
.medical-history-record-header span {
    font-size: 8px;
}

/* =========================================
   BOTÓN NUEVA EVOLUCIÓN
   ========================================= */

.new-history-button-container {
    display: flex;

    justify-content: flex-end;

    margin-top: 12px;

    padding-top: 10px;

    border-top: 1px solid #e1e4e8;
}

/* Separación superior de los títulos de las columnas */

.patient-info-column::before {
    padding-top: 10px;
}

.patient-history-column .medical-history-header {
    padding-top: 10px;
}

/* =========================================
   PAGINACIÓN HISTORIA MÉDICA
   ========================================= */

.medical-history-pagination {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 12px;

    margin-top: 12px;
    padding-top: 10px;

    border-top: 1px solid #e1e4e8;
}

.medical-history-pagination span {
    font-size: 9px;
    font-weight: bold;

    color: var(--cs-navy-700);
}

.medical-history-pagination button:disabled {
    opacity: 0.45;

    cursor: not-allowed;
}

/* =========================================
   FILTROS DE HISTORIA MÉDICA
   ========================================= */

.medical-history-filters {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    column-gap: 10px;
    row-gap: 7px;

    margin-bottom: 10px;
    padding-bottom: 10px;

    border-bottom: 1px solid #e1e4e8;
}

/* =========================================
   CAMPOS
   ========================================= */

.medical-history-filter-field {
    display: flex;
    flex-direction: column;

    gap: 4px;

    min-width: 0;
}

.medical-history-filter-field label {

    font-weight: bold;

    color: var(--cs-navy-700);
}

.medical-history-filter-field input {
    width: 100%;

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

    color: #333;
}

.medical-history-filter-field input:focus {
    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.08);
}

/* =========================================
   BOTONES
   ========================================= */

.medical-history-filter-actions {
    grid-column: 1 / -1;

    display: flex;

    justify-content: flex-end;
    align-items: center;

    gap: 6px;

    margin-top: 2px;
}

/* =========================================
   ADMINISTRADOR DE TURNOS
   ========================================= */

#moduloAdministradorTurnos {
    width: 100%;
    overflow: hidden;
}

/* =========================================
   CABECERA PRINCIPAL
   ========================================= */

#moduloAdministradorTurnos > .module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    background-color: var(--cs-navy-700);
    color: #ffffff;

    border-bottom: 1px solid #d7dce2;
}

#moduloAdministradorTurnos > .module-header h3 {
    margin: 0;

    font-size: 14px;
    font-weight: bold;
}

#moduloAdministradorTurnos
> .module-header
#btnVolverAdministradorTurnos {
    background-color: #ffffff;
    color: var(--cs-navy-700);
    border: 1px solid #ffffff;
}

/* =========================================
   SECCIONES
   ========================================= */

#moduloAdministradorTurnos .form-section {
    padding: 18px;

    background-color: #f8f9fb;

    border-bottom: 1px solid #dfe3e8;
}

#moduloAdministradorTurnos .form-section:last-child {
    border-bottom: none;
}

#moduloAdministradorTurnos .form-section > h4 {
    margin: 0 0 16px 0;

    padding-bottom: 8px;

    border-bottom: 2px solid var(--cs-navy-700);

    font-size: 13px;
    color: var(--cs-navy-700);
}

/* =========================================
   GRILLA NUEVO TURNO
   ========================================= */

#moduloAdministradorTurnos .form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px 20px;
}

/* =========================================
   CAMPOS
   ========================================= */

#moduloAdministradorTurnos .form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

#moduloAdministradorTurnos .form-group label {

    font-weight: bold;
    color: var(--cs-navy-700);
}

#moduloAdministradorTurnos .form-group > input,
#moduloAdministradorTurnos
.turno-paciente-busqueda input,
#moduloAdministradorTurnos
.turno-medico-busqueda input {

    width: 100%;

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

    color: #333;
}

#moduloAdministradorTurnos .form-group input:focus {
    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.10);
}

/* =========================================
   BUSCADORES PACIENTE / MÉDICO
   ========================================= */

#moduloAdministradorTurnos
.turno-paciente-busqueda,

#moduloAdministradorTurnos
.turno-medico-busqueda {

    display: flex;
    align-items: center;

    gap: 7px;
}

#moduloAdministradorTurnos
.turno-paciente-busqueda input,

#moduloAdministradorTurnos
.turno-medico-busqueda input {

    flex: 1;
    min-width: 0;
}

#moduloAdministradorTurnos
.turno-paciente-busqueda .btn-primary,

#moduloAdministradorTurnos
.turno-medico-busqueda .btn-primary {

    flex-shrink: 0;
}

/* =========================================
   RESULTADOS DE BÚSQUEDA
   ========================================= */

#resultadosPacienteTurno,
#resultadosMedicoTurno {

    margin-top: 8px;

    max-height: 180px;

    overflow-y: auto;

    background-color: #ffffff;

    border: 1px solid #d9dee5;
    border-radius: 4px;
}

/* =========================================
   PACIENTE / MÉDICO SELECCIONADO
   ========================================= */

#pacienteSeleccionadoTurno,
#medicoSeleccionadoTurno {

    margin-top: 8px;
    padding: 9px 10px;

    background-color: #eef3f8;

    border-left: 3px solid var(--cs-navy-700);
    border-radius: 3px;

    font-size: 9px;
    color: #333;
}

#pacienteSeleccionadoTurno strong,
#medicoSeleccionadoTurno strong {

    color: var(--cs-navy-700);
}

#pacienteSeleccionadoTurno .btn-secondary,
#medicoSeleccionadoTurno .btn-secondary {

    margin-left: 8px;

    background-color: #ffffff;
    color: var(--cs-navy-700);

    border: 1px solid #b9c4d0;
}

/* =========================================
   BOTÓN CREAR TURNO
   ========================================= */

#moduloAdministradorTurnos .form-actions {

    display: flex;

    justify-content: flex-end;

    margin-top: 18px;
    padding-top: 14px;

    border-top: 1px solid #dfe3e8;
}

#btnGuardarTurno {

    min-width: 120px;

}

/* =========================================
   TURNOS PROGRAMADOS
   ========================================= */

#moduloAdministradorTurnos
.form-section
.module-header {

    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 12px;
    padding-bottom: 8px;

    border-bottom: 2px solid var(--cs-navy-700);
}

#moduloAdministradorTurnos
.form-section
.module-header h4 {

    margin: 0;

    font-size: 13px;

    color: var(--cs-navy-700);
}

#fechaAdministradorTurnos {

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

}

/* =========================================
   TABLA TURNOS PROGRAMADOS
   ========================================= */

#moduloAdministradorTurnos .patients-table {

    width: 100%;

    border-collapse: collapse;

    background-color: #ffffff;

    border: 1px solid #d9dee5;

    font-size: 9px;
}

#moduloAdministradorTurnos
.patients-table th {

    padding: 9px 10px;

    background-color: #eef1f5;

    color: var(--cs-navy-700);

    text-align: left;
    font-weight: bold;

    border-bottom: 1px solid #d7dce2;
}

#moduloAdministradorTurnos
.patients-table td {

    padding: 9px 10px;

    vertical-align: middle;

    border-bottom: 1px solid #eeeeee;
}

#moduloAdministradorTurnos
.patients-table tbody tr:last-child td {

    border-bottom: none;
}

#moduloAdministradorTurnos
.patients-table tbody tr:hover {

    background-color: #f8fafc;
}

/* =========================================
   BOTÓN CANCELAR TURNO
   ========================================= */

#moduloAdministradorTurnos
.btn-cancelar-turno {

    background-color: #ffffff;
    color: #b33a3a;
    border: 1px solid #d7a3a3;

    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#moduloAdministradorTurnos
.btn-cancelar-turno:hover {
    background-color: #fff3f3;
    border-color: #b33a3a;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 800px) {

    #moduloAdministradorTurnos .form-grid {

        grid-template-columns: 1fr;
    }

    #moduloAdministradorTurnos
    > .module-header {

        gap: 10px;
    }

    #moduloAdministradorTurnos
    .form-section
    .module-header {

        align-items: flex-start;
        gap: 10px;
    }
}

/* =========================================
   GESTIÓN DE USUARIOS
   ========================================= */

#moduloGestionUsuarios {
    width: 100%;
    overflow: hidden;
}

/* =========================================
   CABECERA PRINCIPAL
   ========================================= */

#moduloGestionUsuarios > .module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    background-color: var(--cs-navy-700);
    color: #ffffff;

    border-bottom: 1px solid #d7dce2;
}

#moduloGestionUsuarios > .module-header h3 {
    margin: 0;

    font-size: 14px;
    font-weight: bold;
}

#moduloGestionUsuarios
> .module-header
#btnVolverGestionUsuarios {

    background-color: #ffffff;
    color: var(--cs-navy-700);

    border: 1px solid #ffffff;
}

/* =========================================
   SECCIONES
   ========================================= */

#moduloGestionUsuarios .form-section {
    padding: 18px;

    background-color: #f8f9fb;

    border-bottom: 1px solid #dfe3e8;
}

#moduloGestionUsuarios .form-section:last-child {
    border-bottom: none;
}

#moduloGestionUsuarios .form-section > h4 {
    margin: 0 0 16px 0;

    padding-bottom: 8px;

    border-bottom: 2px solid var(--cs-navy-700);

    font-size: 13px;
    color: var(--cs-navy-700);
}

/* =========================================
   GRILLA DEL FORMULARIO
   ========================================= */

#moduloGestionUsuarios .form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px 20px;
}

/* =========================================
   CAMPOS
   ========================================= */

#moduloGestionUsuarios .form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

#moduloGestionUsuarios .form-group label {

    font-weight: bold;
    color: var(--cs-navy-700);
}

#moduloGestionUsuarios
.form-group input,

#moduloGestionUsuarios
.form-group select {

    width: 100%;

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

    color: #333;
}

#moduloGestionUsuarios
.form-group input:focus,

#moduloGestionUsuarios
.form-group select:focus {

    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.10);
}

/* =========================================
   DATOS PROFESIONALES DEL MÉDICO
   ========================================= */

#datosNuevoMedico {
    margin-top: 20px;
    padding-top: 16px;

    border-top: 1px solid #dfe3e8;
}

#datosNuevoMedico > h4 {
    margin: 0 0 16px 0;

    padding-bottom: 8px;

    border-bottom: 1px solid #cfd6de;

    font-size: 11px;
    color: var(--cs-navy-700);
}

/* =========================================
   BOTÓN CREAR USUARIO
   ========================================= */

#moduloGestionUsuarios .form-actions {
    display: flex;

    justify-content: flex-end;

    margin-top: 18px;
    padding-top: 14px;

    border-top: 1px solid #dfe3e8;
}

#btnCrearUsuario {
    min-width: 120px;

}

/* =========================================
   TABLA DE USUARIOS
   ========================================= */

#moduloGestionUsuarios .table-container {
    width: 100%;

    overflow-x: auto;
}

#moduloGestionUsuarios .data-table {
    width: 100%;

    border-collapse: collapse;

    background-color: #ffffff;

    border: 1px solid #d9dee5;

}

#moduloGestionUsuarios .data-table th {
    padding: 9px 10px;

    background-color: #eef1f5;

    color: var(--cs-navy-700);

    text-align: left;
    font-weight: bold;

    border-bottom: 1px solid #d7dce2;
}

#moduloGestionUsuarios .data-table td {
    padding: 9px 10px;

    vertical-align: middle;

    border-bottom: 1px solid #eeeeee;
}

#moduloGestionUsuarios
.data-table tbody tr:last-child td {

    border-bottom: none;
}

#moduloGestionUsuarios
.data-table tbody tr:hover {

    background-color: #f8fafc;
}

/* =========================================
   BOTÓN DESACTIVAR
   ========================================= */

#moduloGestionUsuarios
.btn-desactivar-usuario {

    background-color: #ffffff;
    color: #b33a3a;
    border: 1px solid #d7a3a3;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#moduloGestionUsuarios
.btn-desactivar-usuario:hover {
    background-color: #fff3f3;
    border-color: #b33a3a;
}

/* =========================================
   BOTÓN ACTIVAR
   ========================================= */

#moduloGestionUsuarios
.btn-activar-usuario {

    background-color: #ffffff;
    color: var(--cs-navy-700);
    border: 1px solid #9eafc1;

    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#moduloGestionUsuarios
.btn-activar-usuario:hover {

    background-color: #eef3f8;

    border-color: var(--cs-navy-700);
}

/* =========================================
   BOTONES DESHABILITADOS
   ========================================= */

#moduloGestionUsuarios button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 800px) {

    #moduloGestionUsuarios .form-grid {
        grid-template-columns: 1fr;
    }

    #moduloGestionUsuarios
    > .module-header {

        gap: 10px;
    }
}

/* =========================================
   ALTA DE PACIENTE
   ========================================= */

#moduloAltaPaciente {
    width: 100%;
    overflow: hidden;
}

/* =========================================
   CABECERA
   ========================================= */

#moduloAltaPaciente > .module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    background-color: var(--cs-navy-700);
    color: #ffffff;

    border-bottom: 1px solid #d7dce2;
}

#moduloAltaPaciente > .module-header h3 {
    margin: 0;

    font-size: 14px;
    font-weight: bold;
}

#moduloAltaPaciente
> .module-header
#btnVolverAltaPaciente {

    background-color: #ffffff;
    color: var(--cs-navy-700);

    border: 1px solid #ffffff;
}

/* =========================================
   CUERPO
   ========================================= */

#moduloAltaPaciente .module-body {
    padding: 18px;
    background-color: #f8f9fb;
}

/* =========================================
   FILAS DEL FORMULARIO
   ========================================= */

#moduloAltaPaciente .form-row {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    margin-bottom: 16px;
    align-items: start;
}

/* =========================================
   CAMPOS
   ========================================= */

#moduloAltaPaciente .field-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

#moduloAltaPaciente .field-group label {

    font-weight: bold;
    color: var(--cs-navy-700);
}

#moduloAltaPaciente .field-group input,
#moduloAltaPaciente .field-group select {

    width: 100%;

    border: 1px solid #c8cdd4;

    background-color: #ffffff;

    color: #333;
}

#moduloAltaPaciente .field-group input:focus,
#moduloAltaPaciente .field-group select:focus {

    outline: none;

    border-color: var(--cs-navy-700);

    box-shadow:
        0 0 0 2px rgba(34, 59, 90, 0.10);
}

/* =========================================
   BOTONES
   ========================================= */

#moduloAltaPaciente .actions-group {

    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 20px;
    padding-top: 14px;

    border-top: 1px solid #dfe3e8;
}

#moduloAltaPaciente .actions-group .btn-primary,
#moduloAltaPaciente .actions-group .btn-secondary {
    min-width: 120px;

}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 800px) {

    #moduloAltaPaciente .form-row {
        grid-template-columns: 1fr;
    }

}

/* =========================================================
   CONFIGURACIÓN DE AGENDA
   ========================================================= */

#moduloConfiguracionAgenda {
    overflow: hidden;
}

/* =========================
   CABECERA PRINCIPAL
   ========================= */

#moduloConfiguracionAgenda > .module-header {
    background: var(--cs-navy-700);
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

#moduloConfiguracionAgenda > .module-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

/* =========================
   SECCIONES
   ========================= */

#moduloConfiguracionAgenda .form-section {
    margin: 18px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
}

#moduloConfiguracionAgenda .form-section h4 {
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e9ef;
    color: var(--cs-navy-700);
    font-size: 14px;
    font-weight: 600;
}

/* =========================
   TEXTOS DESCRIPTIVOS
   ========================= */

#moduloConfiguracionAgenda .form-section > p {
    margin: -6px 0 18px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

/* =========================
   CAMPOS
   ========================= */

#moduloConfiguracionAgenda .form-group label {
    display: block;
    margin-bottom: 6px;

    color: #374151;

    font-weight: 600;
}

#moduloConfiguracionAgenda .form-group input,
#moduloConfiguracionAgenda .form-group select {
    width: 100%;

    border: 1px solid #cfd6df;

    background: #ffffff;
    box-sizing: border-box;
}

/* =========================
   MÉDICO SELECCIONADO
   ========================= */

#agendaMedicoSeleccionado .patient-header {
    margin: 0;
    padding: 16px 18px;

    background: #f7f9fc;
    border: 1px solid #dfe5ec;
    border-left: 4px solid var(--cs-navy-700);
    border-radius: 6px;
}

#agendaMedicoSeleccionado .patient-header h2 {
    margin: 0 0 5px;
    color: var(--cs-navy-700);
    font-size: 18px;
}

#agendaEspecialidadMedico {
    color: #6b7280;
    font-size: 11px;
}

/* =========================================================
   AGENDA - HORARIOS SEMANALES
   ========================================================= */

#agendaListaHorarios {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 14px;
}

/* Cada horario generado por JS */

#agendaListaHorarios > div:not(.empty-row) {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 42px;
    padding: 9px 12px;

    background: #f7f9fc;
    border: 1px solid #dfe5ec;
    border-left: 4px solid var(--cs-navy-700);
    border-radius: 6px;

    box-sizing: border-box;
}

/* Inputs y selects de horarios nuevos */

#agendaListaHorarios select,
#agendaListaHorarios input {

    border: 1px solid #cfd6df;

    background: #ffffff;
    box-sizing: border-box;
}

/* =========================================================
   AGENDA - BLOQUEOS Y EXCEPCIONES
   ========================================================= */

#agendaListaExcepciones {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 14px;
}

/* Cada excepción generada por JS */

#agendaListaExcepciones > div:not(.empty-row) {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 42px;
    padding: 9px 12px;

    background: #fff9f5;
    border: 1px solid #eadfd7;
    border-left: 4px solid #b76e3c;
    border-radius: 6px;

    box-sizing: border-box;
}

/* Inputs y selects al agregar bloqueo */

#agendaListaExcepciones select,
#agendaListaExcepciones input {

    border: 1px solid #cfd6df;

    background: #ffffff;
    box-sizing: border-box;
}

/* =========================================================
   BOTONES DE AGENDA
   ========================================================= */

#agendaHorariosSemanales .form-actions,
#agendaExcepciones .form-actions {
    margin-top: 14px;
}

/* Botón guardar final */

#agendaAcciones {
    margin: 18px;
    padding: 18px 0 4px;

    border-top: 1px solid #dfe5ec;

    display: flex;
    justify-content: flex-end;
}

#btnAgendaGuardar {
    min-width: 190px;
}

/* =========================================================
   AGENDA - FILAS EDITABLES
   ========================================================= */

/* Alineación general de controles */

#agendaListaHorarios > div:not(.empty-row),
#agendaListaExcepciones > div:not(.empty-row) {
    flex-wrap: wrap;
}

/* Select de día */

#agendaListaHorarios select {
    min-width: 110px;
}

/* Campos de hora */

#agendaListaHorarios input[type="time"] {
    width: 115px;
}

/* Fecha de excepción */

#agendaListaExcepciones input[type="date"] {
    width: 145px;
}

/* Tipo de excepción */

#agendaListaExcepciones select {
    min-width: 140px;
}

/* Motivo */

#agendaListaExcepciones input[type="text"] {
    min-width: 220px;
    flex: 1;
}

/* =========================
   BOTÓN QUITAR
   ========================= */

#agendaListaHorarios button,
#agendaListaExcepciones button {

    border: 1px solid #c7cdd4;

    background: #ffffff;

    color: #4b5563;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

#agendaListaHorarios button:hover,
#agendaListaExcepciones button:hover {
    background: #f1f3f5;
    border-color: #aeb6c0;
}

/* =========================
   BOTONES AGREGAR
   No tomar el estilo de Quitar
   ========================= */

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 800px) {

    #agendaListaHorarios > div:not(.empty-row),
    #agendaListaExcepciones > div:not(.empty-row) {
        align-items: stretch;
    }

    #agendaListaHorarios select,
    #agendaListaHorarios input,
    #agendaListaExcepciones select,
    #agendaListaExcepciones input {
        width: 100%;
        min-width: 0;
    }
}

/* =========================================================
   LOGIN CARDENAL SALUD
   ========================================================= */

body.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 0;

    background-image: url("../../img/fondo login.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}

/* =========================================================
   DISTRIBUCIÓN GENERAL
   ========================================================= */

.login-layout {
    width: 100%;
    min-height: 100vh;

    display: grid;
    grid-template-columns: 58% 42%;

    align-items: center;
}

/* =========================================================
   LADO IZQUIERDO - CARDENAL
   ========================================================= */

.login-brand {
    height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 50px 40px 50px 70px;
}

.login-cardenal-logo {
    display: block;

    width: 100%;
    max-width: 620px;
    height: auto;

    object-fit: contain;
}

/* =========================================================
   LADO DERECHO - LOGIN
   ========================================================= */

.login-access {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 50px 70px 50px 30px;
}

/* =========================================================
   TARJETA
   ========================================================= */

.login-card {
    width: 100%;
    max-width: 430px;

    padding: 38px 42px 30px;

    background: rgba(255, 255, 255, 0.97);

    border: 1px solid rgba(220, 225, 232, 0.9);
    border-radius: 18px;

    box-shadow:
        0 18px 50px rgba(20, 42, 65, 0.16);
}

/* =========================================================
   LOGO RORAIMA
   ========================================================= */

.login-client {
    display: flex;
    justify-content: center;

    margin-bottom: 28px;
}

.login-client-logo {
    display: block;

    width: 100%;
    max-width: 245px;
    height: auto;

    object-fit: contain;
}

/* =========================================================
   ENCABEZADO
   ========================================================= */

.login-card-header {
    margin-bottom: 26px;
}

.login-card-header h1 {
    margin: 0 0 8px;

    font-size: 25px;
    font-weight: 700;

    color: #163654;
}

.login-card-header p {
    margin: 0;

    font-size: 12px;
    line-height: 1.5;

    color: #6b7280;
}

/* =========================================================
   FORMULARIO
   ========================================================= */

.login-form {
    width: 100%;
}

.login-field {
    width: 100%;

    display: flex;
    flex-direction: column;

    gap: 7px;

    margin-bottom: 18px;
}

.login-field label {
    font-size: 12px;
    font-weight: 600;

    color: #334155;
}

.login-field input {
    width: 100%;
    height: 44px;

    padding: 0 13px;

    background: #ffffff;

    border: 1px solid #d3dae3;
    border-radius: 7px;

    font-family: inherit;
    font-size: 11px;

    color: #263648;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.login-field input::placeholder {
    color: #a0a8b2;
}

.login-field input:focus {
    border-color: #1f4568;

    box-shadow:
        0 0 0 3px rgba(31, 69, 104, 0.10);
}

/* =========================================================
   BOTÓN
   ========================================================= */

.login-button {
    width: 100%;
    height: 46px;

    margin-top: 6px;

    border: none;
    border-radius: 7px;

    background: #173b5d;

    color: #ffffff;

    font-family: inherit;
    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.1s ease,
        box-shadow 0.2s ease;
}

.login-button:hover {
    background: #102f4b;

    box-shadow:
        0 6px 15px rgba(23, 59, 93, 0.18);
}

.login-button:active {
    transform: translateY(1px);
}

/* =========================================================
   PIE DE LA TARJETA
   ========================================================= */

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 25px;
    padding-top: 18px;
    border-top: 1px solid #e7ebef;
    font-size: 10px;
    color: #8a949f;
}

.login-footer strong {
    color: #173b5d;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1000px) {

    body.login-page {
        overflow-y: auto;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-brand {
        height: auto;
        min-height: 240px;

        padding: 50px 30px 20px;
    }

    .login-cardenal-logo {
        max-width: 450px;
    }

    .login-access {
        min-height: auto;

        padding: 20px 25px 60px;
    }

    .login-card {
        max-width: 430px;
    }
}

@media (max-width: 600px) {

    .login-brand {
        min-height: 180px;

        padding: 35px 25px 10px;
    }

    .login-cardenal-logo {
        max-width: 330px;
    }

    .login-access {
        padding: 15px 18px 40px;
    }

    .login-card {
        padding: 30px 25px 25px;

        border-radius: 14px;
    }

    .login-client-logo {
        max-width: 210px;
    }

    .login-card-header h1 {
        font-size: 21px;
    }
}

/* =========================================
   FICHA PACIENTE - VISTA POR ROL
   ========================================= */

/* Administrador y Recepción */
.patient-clinical-layout.patient-layout-consulta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.patient-layout-consulta .patient-info-column {
    display: contents;
}

.patient-layout-consulta .patient-data-section {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.patient-layout-consulta .medical-history-consulta {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Títulos de las secciones */
#fichaPaciente .patient-data-section > .medical-history-header {
    margin-bottom: 10px;
}

/* Vista Médico: conserva las dos columnas */
#fichaPaciente .patient-clinical-layout:not(.patient-layout-consulta) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Pantallas pequeñas */
@media (max-width: 900px) {
    .patient-clinical-layout.patient-layout-consulta,
    #fichaPaciente .patient-clinical-layout:not(.patient-layout-consulta) {
        grid-template-columns: 1fr;
    }

    .patient-layout-consulta .patient-info-column {
        display: block;
    }

    .patient-layout-consulta .patient-data-section,
    .patient-layout-consulta .medical-history-consulta {
        grid-column: 1;
        grid-row: auto;
    }
}

body:not(.login-page) { background:linear-gradient(140deg,#f8fbff 0%,#edf3fa 65%,#f7f9fc 100%); color:#900b31; }
body:not(.login-page) .app-header { min-height:86px; padding:18px 28px; background:linear-gradient(115deg,#fff 0%,#f3f8fd 78%,#fceef3 100%); border-bottom:1px solid #e1eaf3; box-shadow:0 3px 14px rgba(20,49,83,.04); }
body:not(.login-page) .app-layout { gap:18px; padding:18px 16px 26px; align-items:flex-start; }
body:not(.login-page) .sidebar { width:245px; gap:12px; background:#fff; border:1px solid #edf1f7; border-radius:16px; padding:16px 8px; box-shadow:0 8px 25px rgba(28,56,95,.06); }
body:not(.login-page) .sidebar-box { border:0; border-radius:12px; background:transparent; overflow:visible; }
body:not(.login-page) .box-header { border-radius:9px; padding:10px 12px; background:#f1f5fb; color:var(--cs-navy); font-size:11px; }
body:not(.login-page) .profile-content { background:#f8fafd; color:var(--cs-navy); border-radius:12px; padding:14px 10px; }
body:not(.login-page) .profile-avatar { width:58px; height:58px; object-fit:cover; border:2px solid #e3eaf4; }
body:not(.login-page) .user-name { font-size:11px; }
body:not(.login-page) .user-email { color:var(--cs-muted); font-size:9px; }
body:not(.login-page) .sidebar-nav { gap:4px; padding:5px; }
body:not(.login-page) .sidebar-nav a { padding:12px 13px; border:0; border-radius:9px; font-size:10px; color:var(--cs-navy); transition:background-color .15s,color .15s; }
body:not(.login-page) .sidebar-nav a:hover { background:#f8eaf0; color:var(--cs-red-dark); }
body:not(.login-page) .sidebar-nav a.active { background:var(--cs-red); color:#fff; font-weight:700; box-shadow:0 4px 9px rgba(172,16,60,.13); }
body:not(.login-page) .main-content { min-width:0; }
body:not(.login-page) .card-module { background:var(--cs-surface); border:1px solid #e2eaf4; border-radius:15px; box-shadow:0 8px 22px rgba(22,51,88,.045); }
body:not(.login-page) .module-tabs { background:#f7faff; border-bottom:1px solid var(--cs-line); border-radius:15px 15px 0 0; overflow:hidden; }
body:not(.login-page) .tab-btn {  border-right:1px solid #e1eaf4; background:transparent; color:var(--cs-navy);  }
body:not(.login-page) .tab-btn.active { background:var(--cs-red); color:#fff; }
body:not(.login-page) .module-body { background:#fff; padding:20px; }
body:not(.login-page) .field-group label { color:var(--cs-navy);  }
body:not(.login-page) .field-group input {   border:1px solid #ccd9e9;  background:#fbfcff;  }
body:not(.login-page) .field-group input:focus { outline:0; border-color:#7596bc; box-shadow:0 0 0 3px rgba(29,78,128,.09); }
body:not(.login-page) .btn-primary { background:var(--cs-red); color:#fff; }
body:not(.login-page) .btn-primary:hover { background:var(--cs-red-dark); }
body:not(.login-page) .btn-secondary { background:var(--cs-navy); color:#fff; }

body:not(.login-page) .module-bar { background:#fff; color:var(--cs-navy); padding:13px 16px; border-bottom:1px solid var(--cs-line); border-radius:15px 15px 0 0; }
body:not(.login-page) .date-picker,body:not(.login-page) .select-sort {   border:1px solid #cddbea;  background:#fff; color:var(--cs-navy); }
body:not(.login-page) .table-container { border-radius:9px; }

body:not(.login-page) .data-table th { background:#eef3f9; color:var(--cs-navy); padding:11px 10px; border-bottom:1px solid #dbe5ef; }
body:not(.login-page) .data-table td { padding:11px 10px; border-bottom:1px solid #eaf0f6; }
body:not(.login-page) .data-table tbody tr:hover { background:#f8fbff; }
body:not(.login-page) .stats-bar { color:var(--cs-navy); border-top:1px solid #e9eff6; padding-top:12px; }
@media(max-width:850px) { body:not(.login-page) .app-layout { flex-direction:column; padding:12px; } body:not(.login-page) .sidebar { width:100%; } body:not(.login-page) .main-content { width:100%; } body:not(.login-page) .form-row { flex-wrap:wrap; } body:not(.login-page) .module-bar { flex-wrap:wrap; gap:10px; } }

/* ============================================================
   CARDENAL SALUD — IDENTIDAD VISUAL OFICIAL / 09-10-2026
   Capa de personalización. Conserva el CSS previo.
   ============================================================ */

html, body, button, input, select, textarea { font-family:"Poppins",Arial,sans-serif; }
body:not(.login-page) { color:var(--cs-navy); background:linear-gradient(135deg,#f8fafc,#f1f4f7); }
body:not(.login-page) .app-header { background:linear-gradient(110deg,#fff 0%,#f5f8fa 80%,#f9eef0 100%); border-color:var(--cs-line); }
body:not(.login-page) .app-header h1, body:not(.login-page) header h1 { color:var(--cs-navy); }
body:not(.login-page) .sidebar { border-color:var(--cs-line); }
body:not(.login-page) .box-header { background:#f1f4f7; color:var(--cs-navy); }
body:not(.login-page) .profile-content { background:#f7f9fb; color:var(--cs-navy); }
body:not(.login-page) .sidebar-nav a { color:var(--cs-navy); }
body:not(.login-page) .sidebar-nav a:hover { background:#f9edf0; color:var(--cs-red); }
body:not(.login-page) .sidebar-nav a.active,
body:not(.login-page) .sidebar-nav a[aria-current="page"] { background:var(--cs-red); color:#fff; box-shadow:0 4px 10px rgba(136,30,45,.17); }
body:not(.login-page) .card-module { border-color:var(--cs-line); }
body:not(.login-page) .module-tabs { background:#f6f8fa; border-color:var(--cs-line); }
body:not(.login-page) .tab-btn { color:var(--cs-navy); }
body:not(.login-page) .tab-btn.active { background:var(--cs-red); color:#fff; }
body:not(.login-page) .module-bar { background:#fff; color:var(--cs-navy); border-color:var(--cs-line); }
body:not(.login-page) .data-table th,
body:not(.login-page) .patients-table th { background:#f0f3f6; color:var(--cs-navy); border-color:var(--cs-line); }
body:not(.login-page) .data-table tbody tr:hover,
body:not(.login-page) .patients-table tbody tr:hover { background:#faf2f4; }
body:not(.login-page) .stats-bar,
body:not(.login-page) .field-group label { color:var(--cs-navy); }
body:not(.login-page) .btn-primary,
body:not(.login-page) .btn-secondary,
body:not(.login-page) .btn-save-history,
body:not(.login-page) .btn-asignar-medico,
body:not(.login-page) .select-accion-paciente,
body:not(.login-page) .tab-btn.active { background:var(--cs-red); color:#fff; border-color:var(--cs-red); }
body:not(.login-page) .btn-primary:hover,
body:not(.login-page) .btn-secondary:hover,
body:not(.login-page) .btn-save-history:hover,
body:not(.login-page) .btn-asignar-medico:hover,
body:not(.login-page) .select-accion-paciente:hover { background:var(--cs-red-dark); color:#fff; border-color:var(--cs-red-dark); }
body:not(.login-page) .btn-danger { background:var(--cs-red); color:#fff; }
body:not(.login-page) .btn-danger:hover { background:var(--cs-red-dark); }
body:not(.login-page) .btn-edit-history { border-color:var(--cs-red); color:var(--cs-red); }
body:not(.login-page) .btn-edit-history:hover { background:var(--cs-red); color:#fff; }
body:not(.login-page) .medical-history-header,
body:not(.login-page) .asignacion-busqueda h3,
body:not(.login-page) #moduloAdministradorTurnos .form-section > h4,
body:not(.login-page) #moduloGestionUsuarios .form-section > h4,
body:not(.login-page) #moduloAdministradorTurnos .form-section .module-header { border-bottom-color:var(--cs-red); }
body:not(.login-page) .medical-history-record { border-left-color:var(--cs-red); }
body:not(.login-page) .modal-medico-header,
body:not(.login-page) #moduloAdministradorTurnos > .module-header,
body:not(.login-page) #moduloGestionUsuarios > .module-header,
body:not(.login-page) #moduloAltaPaciente > .module-header,
body:not(.login-page) #moduloConfiguracionAgenda > .module-header { background:var(--cs-red); color:#fff; }
body:not(.login-page) #moduloConfiguracionAgenda > .module-header h3 { color:#fff; }
body:not(.login-page) #agendaMedicoSeleccionado .patient-header,
body:not(.login-page) #agendaListaHorarios > div:not(.empty-row),
body:not(.login-page) #pacienteSeleccionadoTurno,
body:not(.login-page) #medicoSeleccionadoTurno,
body:not(.login-page) .asignacion-estado { border-left-color:var(--cs-red); }
body:not(.login-page) #moduloConfiguracionAgenda .form-section h4,
body:not(.login-page) #agendaMedicoSeleccionado .patient-header h2 { color:var(--cs-navy); }
body:not(.login-page) input:focus,
body:not(.login-page) select:focus,
body:not(.login-page) textarea:focus { border-color:var(--cs-muted); box-shadow:0 0 0 3px rgba(104,140,163,.15); outline:none; }
body:not(.login-page) button:disabled { opacity:.55; cursor:not-allowed; }
/* Botones Volver: secundarios blancos sobre encabezado bordo */
body:not(.login-page) #moduloAdministradorTurnos > .module-header .btn-secondary,
body:not(.login-page) #moduloGestionUsuarios > .module-header .btn-secondary,
body:not(.login-page) #moduloAltaPaciente > .module-header .btn-secondary { background:#fff; color:var(--cs-red); border-color:#fff; }
/* Inicio de sesión: tipografía y CTA con la misma identidad */
body.login-page .login-button { background:var(--cs-red); }
body.login-page .login-button:hover { background:var(--cs-red-dark); }
body.login-page .login-card-header h1,
body.login-page .login-footer strong { color:var(--cs-navy); }
body.login-page .login-field input:focus { border-color:var(--cs-muted); box-shadow:0 0 0 3px rgba(104,140,163,.15); }

/* =========================================
   CARDENAL SALUD
   CORRECCIÓN DE MÓDULOS SUPERPUESTOS
   ========================================= */

/* Respetar el estado oculto de cada módulo */
.main-content .card-module[style*="display: none"],
.main-content .card-module[style*="display:none"] {
    display: none !important;
}

/* =========================================
   CARDENAL SALUD - MENÚ ACTIVO
   ========================================= */

.sidebar-nav a.active,
.sidebar-nav a.active:hover {
    background-color: var(--cs-red) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    border-radius: 9px;
    box-shadow: 0 3px 10px rgba(136, 30, 45, 0.14);
}

.sidebar-nav a:not(.active) {
    color: var(--cs-navy);
}

.sidebar-nav a:not(.active):hover {
    background-color: var(--cs-line);
    color: var(--cs-red);
}

/* =========================================
   CARDENAL SALUD
   UNIFICACIÓN VISUAL DE MÓDULOS
   ========================================= */

/* Encabezados */
#moduloAuditorias > .module-header,
#moduloModificarDatos > .module-header,
#moduloConfiguracionAgenda > .module-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--cs-red) !important;
    color: #FFFFFF !important;
    border-radius: 12px 12px 0 0;
}

/* Títulos */
#moduloAuditorias > .module-header h3,
#moduloModificarDatos > .module-header h3,
#moduloConfiguracionAgenda > .module-header h3 {
    margin: 0;
    color: #FFFFFF !important;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 600;
}

/* Botones Volver alineados a la derecha */
#btnVolverAuditorias,
#btnVolverModificarDatos,
#btnVolverConfiguracionAgenda {
    margin: 0 0 0 auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto !important;

    border: 1px solid var(--cs-line) !important;
    background: #FFFFFF !important;
    color: var(--cs-navy) !important;

    cursor: pointer;
}

/* Cuerpo de Auditorías y Modificar Datos */
#moduloAuditorias > .module-body,
#moduloModificarDatos > .module-body {
    padding: 20px !important;
    background: #FFFFFF;
    font-family: "Poppins", sans-serif;
}

/* Subtítulos */
#moduloAuditorias .form-section h3,
#moduloAuditorias .form-section h4,
#moduloModificarDatos .form-section h3,
#moduloModificarDatos .form-section h4 {
    color: var(--cs-navy);
    font-weight: 600;
}

/* Campos */
#moduloAuditorias input,
#moduloAuditorias select,
#moduloModificarDatos input,
#moduloModificarDatos select {
    max-width: 100%;

    border: 1px solid var(--cs-line);

    background: #FFFFFF;
    color: var(--cs-navy);

    box-sizing: border-box;
}

/* Foco de campos */
#moduloAuditorias input:focus,
#moduloAuditorias select:focus,
#moduloModificarDatos input:focus,
#moduloModificarDatos select:focus {
    outline: none;
    border-color: var(--cs-muted);
    box-shadow: 0 0 0 3px rgba(104, 140, 163, 0.15);
}

/* Botones de acción */
#moduloAuditorias .module-body button,
#moduloModificarDatos .module-body button {

    border: 1px solid var(--cs-red);

    background: var(--cs-red);
    color: #FFFFFF;

    cursor: pointer;
}

/* Botones secundarios */
#moduloAuditorias .module-body .btn-secondary,
#moduloModificarDatos .module-body .btn-secondary {
    background: #FFFFFF;
    color: var(--cs-red);
}

/* Bordes y superficies */
#moduloAuditorias,
#moduloModificarDatos {
    overflow: hidden;
    border: 1px solid var(--cs-line);
    border-radius: 12px;
    background: #FFFFFF;
}

/* Adaptación a pantallas pequeñas */
@media (max-width: 600px) {
    #moduloAuditorias > .module-header,
    #moduloModificarDatos > .module-header,
    #moduloConfiguracionAgenda > .module-header {
        padding: 12px;
    }

    #moduloAuditorias > .module-body,
    #moduloModificarDatos > .module-body {
        padding: 14px !important;
    }
}

/* =========================================
   CARDENAL SALUD - BUSCADOR MODIFICAR DATOS
   ========================================= */

#moduloModificarDatos > .module-body > .form-section {
    padding: 8px 4px 14px;
}

/* Título */
#moduloModificarDatos > .module-body > .form-section > h4 {
    margin: 0 0 6px;
    color: var(--cs-navy);
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 600;
}

/* Descripción */
#moduloModificarDatos > .module-body > .form-section > p {
    margin: 0 0 22px;
    color: var(--cs-muted);
    font-family: "Poppins", sans-serif;
    font-size: 10px;
    line-height: 1.6;
}

/* Contenedor del campo */
#moduloModificarDatos > .module-body > .form-section > .form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 650px;
    margin-bottom: 18px;
}

/* Etiqueta */
#moduloModificarDatos #buscarUsuarioModificar {
    display: block;
    width: 100%;

    border: 1px solid var(--cs-line);

    background: #FFFFFF;
    color: var(--cs-navy);

    box-sizing: border-box;
}

#moduloModificarDatos label[for="buscarUsuarioModificar"] {
    display: block;
    width: 100%;
    margin: 0;
    color: var(--cs-navy);

    font-weight: 600;
}

/* Campo activo */
#moduloModificarDatos #buscarUsuarioModificar:focus {
    outline: none;
    border-color: var(--cs-muted);
    box-shadow: 0 0 0 3px rgba(104, 140, 163, 0.15);
}

/* Botones alineados a la derecha */
#moduloModificarDatos > .module-body > .form-section > .form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
}

/* Botones */
#moduloModificarDatos > .module-body > .form-section > .form-actions button {
    min-width: 100px;

    cursor: pointer;
}

/* Botón secundario */
#moduloModificarDatos > .module-body > .form-section > .form-actions .btn-secondary {
    background: #FFFFFF;
    color: var(--cs-red);
    border: 1px solid var(--cs-red);
}

@media (max-width: 600px) {
    #moduloModificarDatos > .module-body > .form-section > .form-group {
        max-width: 100%;
    }

    #moduloModificarDatos > .module-body > .form-section > .form-actions {
        justify-content: stretch;
    }

    #moduloModificarDatos > .module-body > .form-section > .form-actions button {
        flex: 1;
    }
}

/* =========================================
   CARDENAL SALUD - BUSCADOR CIE-10
   ========================================= */

.cie10-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 42, 68, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cie10-modal-contenido {
    background: #ffffff;
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cie10-modal-header {
    background: var(--cs-red);
    color: #ffffff;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cie10-modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

.cie10-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.cie10-modal-body label {
    display: block;
    margin-bottom: 10px;
    color: var(--cs-navy);
    font-weight: 600;
}

#buscarDiagnosticoCIE10 {
    width: 100%;

    border: 1px solid var(--cs-line);

    box-sizing: border-box;

}

.cie10-resultados {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.cie10-resultado {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 6px;
    text-align: left;
    background: #F8FAFC;
    color: var(--cs-navy);
    border: 1px solid var(--cs-line);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.cie10-resultado:hover:not(:disabled) {
    background: #F3E8EA;
    border-color: var(--cs-red);
}

.cie10-resultado:disabled {
    opacity: 0.55;
    cursor: default;
}

.cie10-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--cs-line);
    display: flex;
    justify-content: flex-end;
}

.cie10-modal-footer button {
    background: var(--cs-red);
    color: white;
    border: none;

    cursor: pointer;
}

/* Diagnósticos seleccionados */

.cie10-seleccionados {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.cie10-diagnostico-seleccionado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #F3E8EA;
    border-left: 3px solid var(--cs-red);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--cs-navy);
}

.cie10-diagnostico-seleccionado button {
    background: transparent;
    color: var(--cs-red);
    border: 1px solid var(--cs-red);

    cursor: pointer;
}

/* =========================================
   CARDENAL SALUD
   BOTÓN BUSCAR DIAGNÓSTICO - EDICIÓN
   ========================================= */

.btn-abrir-edicion-cie10 {
    display: block;
    width: 100%;
    margin-top: 10px;

    background-color: var(--cs-red);
    color: #ffffff;

    border: none;

    text-align: center;
    cursor: pointer;

    transition: background-color 0.2s ease;
}

.btn-abrir-edicion-cie10:hover {
    background-color: #6f1825;
}

.btn-abrir-edicion-cie10:focus-visible {
    outline: 2px solid var(--cs-navy);
    outline-offset: 3px;
}

/* =========================================
   CARDENAL SALUD - BOTÓN SELECCIONAR MÉDICO
   ========================================= */

.btn-seleccionar-medico-turno,
.btnSeleccionarMedicoAgenda {
    background-color: #8b1e2d;
    color: #ffffff;
    border: none;

    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-seleccionar-medico-turno:hover,
.btnSeleccionarMedicoAgenda:hover {
    background-color: #6f1724;
}

/* =========================================
   CARDENAL SALUD - MEJORAS DE LEGIBILIDAD
   ========================================= */

/* Texto general */
body {
    font-size: 14px;
    line-height: 1.5;
}

/* Formularios */

/* Botones */

/* Tablas */
table {
    font-size: 12px;
}

/* Etiquetas */

/* Menú de navegación */
.sidebar a,
.sidebar button {
    font-size: 13px;
}

/* Títulos */
h1 {
    font-size: 22px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 18px;
}

/* =========================================
   CARDENAL SALUD - LEGIBILIDAD GENERAL V2
   ========================================= */

body:not(.login-page) .sidebar-nav a,
body:not(.login-page) .box-header,
body:not(.login-page) .user-name {
    font-size: 13px;
}

body:not(.login-page) .user-email {
    font-size: 11px;
}

body:not(.login-page) .tab-btn,
body:not(.login-page) .field-group label {
    font-size: 13px;
}

/* =====================================
   CARDENAL SALUD + RORAIMA
   Identidad visual del panel
   ===================================== */

body:not(.login-page) {
    background-color: #f5f8fc;
    background-image:
        radial-gradient(ellipse 580px 340px at 100% 0%,
            rgba(176, 21, 66, 0.42) 0%,
            rgba(201, 73, 111, 0.28) 43%,
            rgba(229, 169, 189, 0.13) 70%,
            transparent 100%),
        radial-gradient(ellipse 440px 260px at 0% 100%,
            rgba(177, 31, 78, 0.22) 0%,
            rgba(211, 113, 146, 0.14) 52%,
            transparent 100%),
        linear-gradient(135deg, #ffffff 0%, #edf5fb 55%, #ffffff 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

header.cardenal-header {
    min-height: 105px;
    padding: 18px 35px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(110deg,
        #ffffff 0%,
        #f3f8fc 57%,
        #f3d9e2 80%,
        #db8da7 100%);
    border-bottom: 1px solid #e2eaf2;
}

.cardenal-marcas {
    display: flex;
    align-items: center;
    gap: 26px;
    max-width: 100%;
}

.marca-cardenal {
    width: 225px;
    max-height: 72px;
    object-fit: contain;
}

.marca-roraima {
    width: 205px;
    max-height: 76px;
    object-fit: contain;
}

.separador-marcas {
    width: 1px;
    height: 46px;
    background-color: #c4d1df;
    flex-shrink: 0;
}

/* Textos institucionales con estilos independientes. */
body:not(.login-page)::before,
body:not(.login-page)::after {
    position: fixed;
    left: 35px;
    color: #123c64;
    pointer-events: none;
    z-index: 1;
    font-family: inherit;
    white-space: nowrap;
}

body:not(.login-page)::before {
    content: "Cardenal Salud";
    bottom: 58px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

body:not(.login-page)::after {
    content: "Toda tu gestión de salud, en un solo lugar.";
    bottom: 35px;
    font-size: 8px;
    font-weight: 400;
    line-height: 1.4;
}

@media (max-width: 650px) {
    header.cardenal-header {
        padding: 15px;
        min-height: 85px;
    }

    .cardenal-marcas {
        gap: 12px;
    }

    .marca-cardenal,
    .marca-roraima {
        width: min(36vw, 170px);
        height: auto;
    }

    .separador-marcas {
        height: 35px;
    }

    body:not(.login-page)::before,
    body:not(.login-page)::after {
        left: 18px;
    }

    body:not(.login-page)::before {
        font-size: 14px;
        bottom: 50px;
    }

    body:not(.login-page)::after {
        font-size: 8px;
        bottom: 30px;
    }
}

/* Procedimientos médicos en evolución clínica */

.historia-lista-procedimientos {
    margin: 12px 0 12px 0;
    padding: 0;
    width: 100%;
}

.historia-procedimiento-item {
    margin: 0 0 6px 0;
    padding: 0;
    text-align: left;
}

/* =========================================
   CARDENAL SALUD
   BUSCADOR DE PROCEDIMIENTOS
   ========================================= */

/* Botón en edición de evolución */
.btn-abrir-edicion-procedimientos {
    display: block;
    width: 100%;

    background-color: var(--cs-red);
    color: #ffffff;
    border: none;

    cursor: pointer;
}

.btn-abrir-edicion-procedimientos:hover {
    background-color: #6f1725;
}

/* Modal de procedimientos: mismo diseño que CIE-10 */
#modalBuscadorProcedimientos {
    position: fixed;
    inset: 0;
    z-index: 9999;

    background: rgba(15, 42, 68, 0.55);
    align-items: center;
    justify-content: center;
}

/* Campo de búsqueda */
#buscarProcedimiento {
    display: block;
    width: 100%;

    background: #ffffff;
    border: 1px solid var(--cs-line);

    color: var(--cs-navy);
}

#buscarProcedimiento:focus {
    outline: none;
    border-color: var(--cs-red);
    box-shadow: 0 0 0 3px rgba(136, 30, 45, 0.10);
}

/* Resultados */
#resultadosBusquedaProcedimientos {
    width: 100%;
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

/* Diagnósticos y procedimientos médicos */
.historia-lista-diagnosticos,
.historia-diagnostico-item {
    text-transform: lowercase;
}

/* =========================================
   HISTORIA MÉDICA - DIAGNÓSTICOS
   ========================================= */

.historia-lista-diagnosticos {
    margin: 12px 0;
    padding: 0;
    width: 100%;
}

.historia-diagnostico-item {
    margin: 0 0 6px 0;
    padding: 0;
    text-align: left;
    text-transform: none;
}

/* =========================================
   CARDENAL SALUD
   PACIENTES CON TURNO — ALINEACIÓN
   ========================================= */
body:not(.login-page) .main-content #moduloSalaEspera {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 15px 0 20px;
    clear: both;
}

/* ACTIVIDAD MÉDICA - PAGINACIÓN */

.paginacion-actividad {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 4px;
    color: var(--cs-navy);
    font-size: 12px;
}

.paginacion-actividad-controles {
    display: flex;
    align-items: center;
    gap: 12px;
}

.paginacion-actividad button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* =========================================
   CARDENAL SALUD - ACTIVIDAD MÉDICA
   MISMO DISEÑO QUE AUDITORÍAS
   ========================================= */

#moduloActividadMedica {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--cs-line);
    border-radius: 12px;
    background: #FFFFFF;
}

/* Encabezado bordó */

#moduloActividadMedica > .module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--cs-red) !important;
    color: #FFFFFF !important;
    border-radius: 12px 12px 0 0;
}

#moduloActividadMedica > .module-header h3 {
    margin: 0;
    color: #FFFFFF !important;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 600;
}

/* Botón Volver */

#btnVolverActividadMedica {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto !important;

    border: 1px solid var(--cs-line) !important;

    background: #FFFFFF !important;
    color: var(--cs-navy) !important;

    cursor: pointer;
}

/* Cuerpo y secciones */

#moduloActividadMedica > .module-body {
    padding: 20px !important;
    background: #FFFFFF;
    font-family: "Poppins", sans-serif;
}

#moduloActividadMedica .form-section {
    padding: 4px 0 18px;
    margin: 0 0 16px;
    background: #FFFFFF;
}

#moduloActividadMedica .form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

#moduloActividadMedica .form-section h4 {
    margin: 0 0 12px;
    color: var(--cs-navy);
    font-size: 14px;
    font-weight: 600;
}

/* Filtros */

#moduloActividadMedica .form-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 14px;
}

#moduloActividadMedica .field-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

#moduloActividadMedica .field-group label {
    color: var(--cs-navy);

    font-weight: 600;
    white-space: nowrap;
}

#moduloActividadMedica .field-group input,
#moduloActividadMedica .field-group select {

    max-width: 100%;

    border: 1px solid var(--cs-line);

    background: #FFFFFF;
    color: var(--cs-navy);

}

#actividadFechaDesde,
#actividadFechaHasta {
    width: 155px;
}

#actividadMedico {
    min-width: 200px;
    max-width: 260px;
}

#moduloActividadMedica input:focus,
#moduloActividadMedica select:focus {
    outline: none;
    border-color: var(--cs-muted);
    box-shadow: 0 0 0 3px rgba(104, 140, 163, 0.15);
}

/* Botones Buscar, Limpiar y Exportar */

#moduloActividadMedica .actions-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
}

#moduloActividadMedica .actions-group button {

    border: 1px solid var(--cs-red);

    background: var(--cs-red);
    color: #FFFFFF;

    cursor: pointer;
}

#moduloActividadMedica .actions-group button:hover {
    background: var(--cs-red-dark);
    color: #FFFFFF;
}

#moduloActividadMedica #btnLimpiarActividadMedica {
    background: #FFFFFF;
    color: var(--cs-red);
}

#moduloActividadMedica #btnLimpiarActividadMedica:hover {
    background: #F9EDF0;
}

/* Tabla de resultados */

#moduloActividadMedica .table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 7px;
}

#moduloActividadMedica .data-table {
    width: 100%;
    border-collapse: collapse;

}

#moduloActividadMedica .data-table th {
    padding: 11px 10px;
    background: #F0F3F6;
    color: var(--cs-navy);
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

#moduloActividadMedica .data-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--cs-line);
}

#moduloActividadMedica .data-table tbody tr:hover {
    background: #FAF2F4;
}

/* Paginación */

#moduloActividadMedica .paginacion-actividad {
    margin-top: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--cs-navy);
}

#moduloActividadMedica .paginacion-actividad-controles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#moduloActividadMedica .paginacion-actividad-controles button {

    border: 1px solid var(--cs-red);

    background: var(--cs-red);
    color: #FFFFFF;

    cursor: pointer;
}

#moduloActividadMedica .paginacion-actividad-controles button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Pantallas pequeñas */

@media (max-width: 700px) {
    #moduloActividadMedica > .module-body {
        padding: 14px !important;
    }

    #moduloActividadMedica .field-group {
        flex-wrap: wrap;
    }

    #moduloActividadMedica .actions-group {
        justify-content: flex-start;
    }
}

/* CARDENAL SALUD - TAMAÑO UNIFICADO DE BOTONES */

button,
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
input[type="button"],
input[type="submit"] {

    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* CARDENAL SALUD - AJUSTE PUNTUAL BOTONES ALTA PACIENTE
   Evita afectar el menú, los turnos y los demás módulos. */
#moduloAltaPaciente .actions-group .btn-primary,
#moduloAltaPaciente .actions-group .btn-secondary {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
