:root {
    --azul-principal: #14529D;
    --azul-hover: #1D66BD;
    --azul-oscuro: #071542;
    --gris-fondo: #EEF3F7;
    --gris-claro: #D9E2EA;
    --blanco: #FFFFFF;
    --rojo: #DA251C;
    --rojo-hover: #B91C1C;
    --texto: #1F2933;
    --texto-claro: #FFFFFF;
    --borde: #B8C7D6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13px;
    background: var(--gris-fondo);
    color: var(--texto);
}

.medica-header {
    background: var(--azul-principal);
    padding: 8px 0;
    text-align: center;
}

.medica-content {
    padding: 24px;
}

.medica-card {
    max-width: 900px;
    margin: 0 auto;
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.medica-card-title {
    background: var(--azul-principal);
    color: var(--texto-claro);
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.medica-form {
    padding: 18px;
}

.medica-table {
    width: 100%;
    border-collapse: collapse;
}

.medica-table td,
.medica-table th {
    border: 1px solid var(--borde);
    padding: 7px;
}

.medica-table th {
    background: var(--azul-principal);
    color: var(--blanco);
    font-weight: 600;
}

.medica-label {
    font-weight: 600;
    color: var(--texto);
    width: 180px;
}

input[type="text"],
input[type="date"],
input[type="password"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--borde);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

input[readonly],
textarea[readonly] {
    background: #F5F7FA;
    color: #555;
}

.medica-actions {
    text-align: center;
    padding: 12px;
}

.btn {
    display: inline-block;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.20s ease, opacity 0.20s ease;
}

.btn-primary {
    background: var(--azul-principal);
    color: var(--blanco);
}

.btn-secondary {
    background: var(--gris-claro);
    color: var(--texto);
}

.btn-danger {
    background: var(--rojo);
    color: var(--blanco);
}

.btn:hover {
    opacity: 0.9;
}

.medica-success {
    margin: 16px;
    padding: 12px;
    border-radius: 6px;
    background: #E8F7EE;
    color: #176B3A;
    border: 1px solid #B7E2C5;
}

.medica-error {
    margin: 16px;
    padding: 12px;
    border-radius: 6px;
    background: #FDECEC;
    color: #A42424;
    border: 1px solid #F4B4B4;
}

/* MENU LATERAL */

.menu {
    width: 170px;
    margin: 0;
}

.menu-section {
    background: #D9E2EA;
    color: #374151;
    font-weight: 600;
    text-align: center;
    padding: 9px 8px;
    margin-top: 18px;
    margin-bottom: 9px;
    border-radius: 5px;
    letter-spacing: 0.2px;
    font-size: 13px;
}

.menu-link {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 56px;

    background: var(--azul-principal);
    color: var(--blanco);

    text-align: center;
    text-decoration: none;

    padding: 8px 10px;
    margin: 7px 0;

    border-radius: 6px;

    font-size: 12px;
    line-height: 1.25;

    transition: background 0.20s ease, transform 0.15s ease, box-shadow 0.20s ease;
}

.menu-link:visited {
    color: var(--blanco);
}

.menu-link:hover {
    background: var(--azul-hover);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.menu-home {
    background: var(--rojo);
    font-weight: 600;
}

.menu-home:hover {
    background: var(--rojo-hover);
}

.menu-footer {
    margin-top: 20px;
    padding: 12px 4px;
    text-align: center;
    font-size: 10px;
    line-height: 1.5;
    color: #667085;
    border-top: 1px solid #C8D1DA;
}

.menu-footer a {
    color: #667085;
    text-decoration: none;
}

.menu-footer a:visited {
    color: #667085;
}

/* ESTRUCTURA PRINCIPAL DE MEDICA 2.0 */

.medica-layout {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: calc(100vh - 127px);
}

.medica-layout .medica-sidebar {
    width: 194px;
    flex: 0 0 194px;

    height: calc(100vh - 127px);
    min-height: 500px;

    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;

    background: #E5E8ED;
}

.medica-layout .medica-content {
    flex: 1;
    min-width: 0;
    padding: 24px 35px;
}

/* PIE DE PÁGINA */

.medica-footer {
    width: 100%;
    padding: 10px 20px;

    text-align: center;
    font-size: 11px;
    color: #667085;

    background: #E5E8ED;
    border-top: 1px solid #C8D1DA;
}

/* NUEVA SECCION */
.medica-card-wide {
    max-width: 1050px;
}

.clinical-section {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid #D6E0E8;
}

.clinical-section:last-of-type {
    border-bottom: none;
}

.clinical-section-title {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #E7EEF5;
    color: #20466F;
    border-left: 5px solid var(--azul-principal);
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-vitals {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.form-field {
    margin-bottom: 16px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #34495E;
}

.textarea-medium {
    min-height: 90px;
}

.textarea-large {
    min-height: 130px;
}

@media (max-width: 900px) {

    .form-grid,
    .form-grid-vitals {
        grid-template-columns: 1fr;
    }

    .form-field-full {
        grid-column: auto;
    }

    .patient-validation {
        margin-top: 8px;
        font-size: 13px;
        line-height: 1.5;
    }
}

.patient-validation-loading,
.patient-validation-success,
.patient-validation-warning,
.patient-validation-error {
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
}

.patient-validation-loading {
    background-color: #eef4fb;
    border-color: #b8cce4;
}

.patient-validation-success {
    background-color: #e4f4e9;
    border-color: #abd8b8;
}

.patient-validation-warning {
    background-color: #fff5db;
    border-color: #e8cc7b;
}

.patient-validation-error {
    background-color: #fdeaea;
    border-color: #efaaaa;
}

.patient-validation-actions {
    margin-top: 10px;
}

.medica-form input:disabled,
.medica-form textarea:disabled,
.medica-form select:disabled {
    background-color: #eef1f4;
    color: #777;
    cursor: not-allowed;
    opacity: 0.75;
}

.medica-form button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* VESTIDO DE MEDICA */

/* =========================================================
   MEDICA 2.0
   ENCABEZADO PRINCIPAL RESPONSIVO
   ========================================================= */

:root {
    --medica-header-dark: #082c52;
    --medica-header-blue: #0a4f87;
    --medica-header-teal: #0799a4;
    --medica-header-text: #ffffff;
    --medica-header-muted: #d8e8f3;
    --medica-header-border: rgba(255, 255, 255, 0.18);
    --medica-header-hover: rgba(255, 255, 255, 0.12);
    --medica-focus: #67d5db;
}


/* ---------------------------------------------------------
   CABECERA GENERAL
   --------------------------------------------------------- */

.medica-header {
    position: relative;
    z-index: 1000;

    width: 100%;
    min-height: 100px;

    color: var(--medica-header-text);

    background:
        linear-gradient(115deg,
            var(--medica-header-dark) 0%,
            var(--medica-header-blue) 62%,
            var(--medica-header-teal) 100%);

    border-bottom: 1px solid rgba(255, 255, 255, 0.14);

    box-shadow:
        0 4px 14px rgba(4, 33, 61, 0.22),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.medica-header-inner {
    width: min(100%, 1600px);
    min-height: 100px;

    margin: 0 auto;
    padding: 12px 24px;

    display: flex;
    align-items: center;
    gap: 20px;
}


/* ---------------------------------------------------------
   MARCA Y LOGO
   --------------------------------------------------------- */

.medica-brand {
    display: inline-flex;
    align-items: center;

    flex: 0 1 470px;
    min-width: 250px;

    overflow: hidden;

    text-decoration: none;
    border-radius: 10px;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.medica-brand:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.medica-brand:active {
    transform: scale(0.99);
}

.medica-brand:focus-visible {
    outline: 3px solid var(--medica-focus);
    outline-offset: 4px;
}


/*
   Logo maestro oficial:
   2400 × 400 px
   Proporción 6:1
*/

.medica-brand-logo {
    display: block;

    width: auto;
    height: 70px;
    max-width: 100%;

    object-fit: contain;
    object-position: left center;

    flex-shrink: 0;
}


/* ---------------------------------------------------------
   INFORMACIÓN DEL MÉDICO
   --------------------------------------------------------- */

.medica-header-doctor {
    min-width: 240px;
    padding-left: 20px;

    display: flex;
    align-items: center;
    gap: 12px;

    border-left: 1px solid rgba(255, 255, 255, 0.20);
}

/* Icono circular del médico */

.medica-header-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;

    display: grid;
    place-items: center;

    font-size: 18px;
    color: #ffffff;

    background-color: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
}

/* Icono médico vectorial */

.medica-doctor-svg {
    width: 24px;
    height: 24px;

    display: block;

    fill: none;
    stroke: #ffffff;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Contenedor de nombre y especialidad */

.medica-header-doctor-text {
    min-width: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;

    line-height: 1.2;
}

/* Nombre del médico */

.medica-header-doctor-text strong {
    overflow: hidden;

    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.15px;

    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Especialidad */

.medica-header .medica-header-doctor-text span {
    display: block;

    max-width: 210px;

    margin-top: 3px;

    color: rgba(225, 242, 249, 0.92) !important;

    font-size: 12px !important;
    font-weight: 400;

    line-height: 1.15;

    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* ---------------------------------------------------------
   FECHA Y HORA
   Refinamiento visual
   --------------------------------------------------------- */

.medica-header-datetime {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 18px;
}


/* Bloques individuales */

.medica-header-date,
.medica-header-time {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Alineación fina de los iconos con Fecha y Hora */

.medica-header-date-icon,
.medica-header-time-icon {
    transform: translateY(-8px);
}


/* Fecha */

.medica-header-date {
    min-width: 128px;
}

.medica-header-date>div {
    display: flex;
    flex-direction: column;
    justify-content: center;

    line-height: 1.15;
}


/* Fecha principal */

.medica-header-date strong {
    color: #ffffff;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15px;

    white-space: nowrap;
}


/* Día de la semana */

.medica-header-date span:not(.medica-header-date-icon) {
    margin-top: 4px;

    color: rgba(225, 242, 249, 0.88);

    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.10px;

    white-space: nowrap;
}


/* Hora */

.medica-header-time {
    min-width: 112px;
}

.medica-header-time strong {
    color: #ffffff;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15px;

    white-space: nowrap;
}


/* Iconos */

.medica-header-date-icon,
.medica-header-time-icon {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    display: grid;
    place-items: center;

    color: #ffffff;
    font-size: 17px;

    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);

    border-radius: 9px;
}

.medica-header-exit {
    margin-left: 14px;
}


/* ---------------------------------------------------------
   BOTÓN SALIR
   --------------------------------------------------------- */

.medica-header-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 42px;
    padding: 0 16px;

    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;

    background: rgba(255, 255, 255, 0.08);

    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9px;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    transition:
        background-color 0.20s ease,
        border-color 0.20s ease,
        box-shadow 0.20s ease,
        transform 0.15s ease;
}

.medica-header-exit:hover {
    color: #ffffff;

    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.42);

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);

    transform: translateY(-1px);
}

.medica-header-exit:active {
    transform: translateY(0);
}

.medica-header-exit:focus-visible {
    outline: 3px solid var(--medica-focus);
    outline-offset: 3px;
}

.medica-header-exit-icon {
    font-size: 20px;
    line-height: 1;
}


/* ---------------------------------------------------------
   BOTÓN HAMBURGUESA
   Oculto en escritorio
   --------------------------------------------------------- */

.medica-menu-toggle {
    display: none;

    width: 44px;
    height: 44px;
    padding: 10px;
    flex: 0 0 44px;

    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;

    color: #ffffff;

    background-color: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 9px;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.medica-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.17);
    border-color: rgba(255, 255, 255, 0.34);
}

.medica-menu-toggle:focus-visible {
    outline: 3px solid var(--medica-focus);
    outline-offset: 3px;
}

.medica-menu-toggle span {
    display: block;

    width: 22px;
    height: 2px;

    background-color: #ffffff;
    border-radius: 999px;

    transform-origin: center;

    transition:
        transform 0.25s ease,
        opacity 0.2s ease;
}


/* Animación del botón cuando el menú está abierto */

body.menu-abierto .medica-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.menu-abierto .medica-menu-toggle span:nth-child(2) {
    opacity: 0;
}

body.menu-abierto .medica-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* =========================================================
   TABLETS Y PANTALLAS MEDIANAS
   ========================================================= */

@media (max-width: 1100px) {

    .medica-header {
        min-height: 88px;
    }

    .medica-header-inner {
        min-height: 88px;

        padding: 10px 18px;
        gap: 15px;
    }

    .medica-menu-toggle {
        display: flex;
    }

    .medica-brand {
        flex-basis: 380px;
        min-width: 220px;
    }

    .medica-brand-logo {
        width: auto;
        height: 62px;
        max-width: 100%;
    }

    .medica-header-doctor {
        min-width: 190px;
        padding-left: 15px;
    }

    .medica-header-datetime {
        gap: 12px;
    }

    .medica-header-date {
        display: none;
    }
}


/* =========================================================
   TABLETS VERTICALES
   ========================================================= */

@media (max-width: 850px) {

    .medica-header-inner {
        gap: 12px;
    }

    .medica-brand {
        flex: 1 1 auto;
        min-width: 180px;
    }

    .medica-brand-logo {
        width: auto;
        height: 56px;
        max-width: 100%;
    }

    .medica-header-doctor {
        min-width: 0;
        padding-left: 12px;
    }

    .medica-header-icon {
        display: none;
    }

    .medica-header-doctor-text strong {
        max-width: 160px;
        font-size: 13px;
    }

    .medica-header-doctor-text span {
        max-width: 160px;
        font-size: 11px;
    }

    .medica-header-time {
        display: none;
    }
}


/* =========================================================
   CELULARES
   ========================================================= */

@media (max-width: 620px) {

    .medica-header,
    .medica-header-inner {
        min-height: 72px;
    }

    .medica-header-inner {
        padding: 8px 10px;
        gap: 9px;
    }

    .medica-menu-toggle {
        width: 40px;
        height: 40px;
        flex-basis: 40px;

        padding: 8px;
    }

    .medica-menu-toggle span {
        width: 20px;
    }

    .medica-brand {
        min-width: 0;
        flex: 1 1 auto;

        overflow: hidden;
    }

    .medica-brand-logo {
        width: auto;
        height: 46px;
        max-width: 100%;
    }

    .medica-header-doctor,
    .medica-header-datetime {
        display: none;
    }

    .medica-header-exit {
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0;

        flex: 0 0 40px;

        border-radius: 9px;
    }

    .medica-header-exit-text {
        position: absolute;

        width: 1px;
        height: 1px;

        padding: 0;
        margin: -1px;

        overflow: hidden;

        white-space: nowrap;
        clip: rect(0, 0, 0, 0);

        border: 0;
    }

    .medica-header-exit-icon {
        font-size: 21px;
    }
}


/* =========================================================
   CELULARES PEQUEÑOS
   ========================================================= */

@media (max-width: 390px) {

    .medica-header-inner {
        padding-right: 7px;
        padding-left: 7px;
        gap: 7px;
    }

    .medica-brand-logo {
        width: auto;
        height: 40px;
        max-width: 100%;
    }

    .medica-menu-toggle,
    .medica-header-exit {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
}


/* =========================================================
   ACCESIBILIDAD Y PREFERENCIAS DE MOVIMIENTO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .medica-brand,
    .medica-header-exit,
    .medica-menu-toggle,
    .medica-menu-toggle span {
        transition: none;
    }
}


/* =========================================================
   IMPRESIÓN
   ========================================================= */

@media print {

    .medica-header {
        color: #000000;

        background: #ffffff;
        border-bottom: 1px solid #cccccc;
        box-shadow: none;
    }

    .medica-header-inner {
        min-height: auto;
        padding: 8px 0;
    }

    .medica-brand-logo {
        width: auto;
        height: 50px;
        max-width: 300px;
    }

    .medica-menu-toggle,
    .medica-header-doctor,
    .medica-header-datetime,
    .medica-header-exit {
        display: none !important;
    }
}

/* =========================================================
   AJUSTE DEFINITIVO DEL HEADER MEDICA 2.0
   Neutraliza estilos antiguos del encabezado y sus imágenes
   ========================================================= */

/* Evita que el encabezado produzca desbordamiento horizontal */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}


/* Encabezado principal */

.medica-header {
    width: 100%;
    min-height: 94px;
    overflow: hidden;
}


/* Mantiene todos los componentes en una sola línea */

.medica-header .medica-header-inner {
    width: 100%;
    max-width: 1600px;
    min-height: 94px;

    margin: 0 auto;
    padding: 10px 24px;

    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    box-sizing: border-box;
    gap: 18px;
}


/* Contenedor exacto del logo */

.medica-header .medica-brand {
    width: 420px;
    max-width: 420px;
    min-width: 420px;

    height: 70px;

    flex: 0 0 420px;

    display: flex;
    align-items: center;

    padding: 0;
    margin: 0;

    overflow: hidden;
}


/*
   Se usa un selector más específico para vencer cualquier
   regla antigua como ".medica-header img".
*/

.medica-header .medica-brand .medica-brand-logo {
    display: block !important;

    width: 420px !important;
    max-width: 420px !important;

    height: 70px !important;
    max-height: 70px !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain !important;
    object-position: left center !important;

    flex: 0 0 auto;
}


/* Información del médico */

.medica-header .medica-header-doctor {
    min-width: 0 !important;
    max-width: 230px !important;

    flex: 1 1 210px !important;

    display: flex;
    align-items: center;
    gap: 10px;

    color: #ffffff;

    border-left: 1px solid rgba(255, 255, 255, 0.20);
}

.medica-header .medica-header-doctor-text {
    display: flex;
    flex-direction: column;

    min-width: 0;

    color: #ffffff;
    line-height: 1.25;
}

.medica-header .medica-header-doctor-text strong {
    display: block;

    margin: 0;
    padding: 0;

    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.3;

    white-space: nowrap;
}

.medica-header .medica-header-doctor-text span {
    display: block;

    margin-top: 3px;
    padding: 0;

    color: #d8e8f3 !important;
    font-size: 12px !important;
    font-weight: 400;
    line-height: 1.3;

    white-space: nowrap;
}


/* Fecha y hora */

.medica-header .medica-header-datetime {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 16px;

    color: #ffffff;
}

.medica-header .medica-header-date strong,
.medica-header .medica-header-time strong {
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
}

.medica-header .medica-header-date span {
    color: #d8e8f3 !important;
}


/* Botón Salir */

.medica-header .medica-header-exit {
    min-width: 74px;
    min-height: 42px;

    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;

    text-decoration: none !important;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .medica-header {
        min-height: 84px;
    }

    .medica-header .medica-header-inner {
        min-height: 84px;
        padding: 8px 16px;
        gap: 12px;
    }

    .medica-header .medica-brand {
        width: 336px;
        max-width: 336px;
        min-width: 336px;
        height: 56px;

        flex-basis: 336px;
    }

    .medica-header .medica-brand .medica-brand-logo {
        width: 336px !important;
        max-width: 336px !important;

        height: 56px !important;
        max-height: 56px !important;
    }

    .medica-header .medica-header-doctor {
        min-width: 180px;
        padding-left: 12px;
    }
}


/* =========================================================
   TABLET VERTICAL
   ========================================================= */

@media (max-width: 850px) {

    .medica-header .medica-brand {
        width: 288px;
        max-width: 288px;
        min-width: 0;
        height: 48px;

        flex: 1 1 288px;
    }

    .medica-header .medica-brand .medica-brand-logo {
        width: 288px !important;
        max-width: 100% !important;

        height: 48px !important;
        max-height: 48px !important;
    }

    .medica-header .medica-header-doctor {
        min-width: 150px;
        max-width: 180px;
    }
}


/* =========================================================
   CELULAR
   ========================================================= */

@media (max-width: 620px) {

    .medica-header {
        min-height: 68px;
    }

    .medica-header .medica-header-inner {
        min-height: 68px;
        padding: 7px 10px;
        gap: 8px;
    }

    .medica-header .medica-brand {
        width: auto;
        max-width: none;
        min-width: 0;
        height: 42px;

        flex: 1 1 auto;
    }

    .medica-header .medica-brand .medica-brand-logo {
        width: auto !important;
        max-width: 100% !important;

        height: 42px !important;
        max-height: 42px !important;
    }

    .medica-header .medica-header-doctor,
    .medica-header .medica-header-datetime {
        display: none !important;
    }
}


/* =========================================================
   CELULAR PEQUEÑO
   ========================================================= */

@media (max-width: 390px) {

    .medica-header .medica-brand {
        height: 36px;
    }

    .medica-header .medica-brand .medica-brand-logo {
        height: 36px !important;
        max-height: 36px !important;
    }
}

/* =========================================================
   MEDICA 2.0
   FASE 1 — ESTRUCTURA Y ALTURA DEL HEADER EN ESCRITORIO
   ========================================================= */

.medica-header {
    width: 100%;
    height: 100px;
    min-height: 100px;
    overflow: hidden;
    box-sizing: border-box;
}

.medica-header-inner {
    width: 100%;
    max-width: 1600px;

    height: 100px;
    min-height: 100px;

    margin: 0 auto;
    padding: 10px 24px;

    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;

    gap: 20px;
    box-sizing: border-box;
}


/* Caja reservada exclusivamente para el logo */

.medica-header .medica-brand {
    width: 480px;
    min-width: 480px;
    max-width: 480px;
    height: 80px;

    flex: 0 0 480px;

    display: flex;
    align-items: center;

    margin: 0;
    padding: 0;
    overflow: hidden;
}


/* Tamaño real mostrado del logo: 480 × 80 px */

.medica-header .medica-brand-logo {
    display: block !important;

    width: 480px !important;
    min-width: 480px !important;
    max-width: 480px !important;

    height: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain !important;
    object-position: left center !important;
}


/* Los demás componentes permanecen en la misma fila */

.medica-header-doctor {
    flex: 0 0 auto;
    margin: 0;
}

.medica-header-datetime {
    flex: 0 0 auto;
    margin-left: auto;
}

.medica-header-exit {
    flex: 0 0 auto;
    margin: 0;
}

/* =========================================================
   MEDICA 2.0
   FASE 3B — FONDO PREMIUM OFICIAL DEL HEADER
   Opción C — Fondos oscuros
   ========================================================= */

.medica-header {

    /*
       CAPA 1:
       Luz ambiental detrás del logo y zona central.
    */
    background:
        radial-gradient(ellipse at 32% 50%,
            rgba(36, 164, 204, 0.35) 0%,
            rgba(23, 111, 164, 0.25) 24%,
            rgba(10, 55, 95, 0.08) 42%,
            rgba(7, 27, 54, 0) 60%),

        /*
           CAPA 2:
           Recorrido institucional del header.
           Azul profundo → azul médico → turquesa.
        */
        linear-gradient(100deg,
            #071B36 0%,
            #0A2D52 20%,
            #0F4B76 45%,
            #126F91 68%,
            #1199A6 86%,
            #0AAEB4 100%);

    /*
       Línea inferior muy discreta.
    */
    border-bottom:
        1px solid rgba(74, 220, 225, 0.38);

    /*
       Profundidad del encabezado.
    */
    box-shadow:
        0 5px 14px rgba(4, 27, 50, 0.22),
        0 1px 0 rgba(255, 255, 255, 0.07) inset;
}

.medica-header .medica-header-exit {
    margin-left: 18px !important;
}

/* =========================================================
   MEDICA 2.0
   AJUSTE FINAL DE DISTRIBUCIÓN DEL HEADER - ESCRITORIO

   1. Médico centrado en el banner
   2. Fecha y hora en la misma línea visual
   3. Iconos alineados con fecha y hora
   ========================================================= */

@media (min-width: 1101px) {

    /* Necesario para centrar al médico dentro del banner */
    .medica-header .medica-header-inner {
        position: relative;
    }


    /* -----------------------------------------------------
       BLOQUE DEL MÉDICO
       Centrado independientemente del logo y fecha/hora
       ----------------------------------------------------- */

    .medica-header .medica-header-doctor {
        position: absolute;

        left: 50%;
        top: 50%;

        transform: translate(-50%, -50%);

        width: 290px;
        min-width: 290px;
        max-width: 290px;

        margin: 0;
        padding-left: 20px;
    }


    /* -----------------------------------------------------
       BLOQUE FECHA + HORA
       ----------------------------------------------------- */

    .medica-header .medica-header-datetime {
        margin-left: auto;

        display: flex;
        align-items: flex-start;

        gap: 20px;
    }


    /* Fecha y hora parten exactamente de la misma altura */

    .medica-header .medica-header-date,
    .medica-header .medica-header-time {
        display: flex;

        align-items: flex-start;

        gap: 10px;

        margin: 0;
        padding: 0;
    }


    /* -----------------------------------------------------
       FECHA
       ----------------------------------------------------- */

    .medica-header .medica-header-date {
        min-width: 128px;
    }

    .medica-header .medica-header-date>div {
        display: flex;
        flex-direction: column;

        justify-content: flex-start;

        margin: 0;
        padding: 0;

        line-height: 1.15;
    }

    .medica-header .medica-header-date strong {
        display: block;

        margin: 0;
        padding: 0;

        line-height: 18px;
    }

    .medica-header .medica-header-date span:not(.medica-header-date-icon) {
        display: block;

        margin-top: 3px;

        line-height: 14px;
    }


    /* -----------------------------------------------------
       HORA
       ----------------------------------------------------- */

    .medica-header .medica-header-time {
        min-width: 118px;

        align-items: flex-start;
    }

    .medica-header .medica-header-time strong {
        display: block;

        margin: 0;
        padding: 0;

        line-height: 18px;
    }


    /* -----------------------------------------------------
       ICONOS FECHA / HORA
       Ambos parten de la misma línea que sus textos
       ----------------------------------------------------- */

    .medica-header .medica-header-date-icon,
    .medica-header .medica-header-time-icon {
        width: 34px;
        height: 34px;

        flex: 0 0 34px;

        display: grid;
        place-items: center;

        margin: 0;
        padding: 0;
    }


    /* -----------------------------------------------------
       BOTÓN SALIR
       Conservamos el espacio aprobado
       ----------------------------------------------------- */

    .medica-header .medica-header-exit {
        margin-left: 18px !important;
    }

}

/* =========================================================
   MEDICA 2.0
   PÁGINA PRINCIPAL / DASHBOARD
   ========================================================= */

.medica-home-welcome {
    position: relative;

    margin-bottom: 26px;
    padding: 28px 32px;

    overflow: hidden;

    background:
        radial-gradient(circle at 85% 35%,
            rgba(29, 166, 183, 0.16),
            transparent 40%),
        linear-gradient(110deg,
            #ffffff 0%,
            #f6fafc 60%,
            #eef7f9 100%);

    border: 1px solid #d5e2ea;
    border-radius: 10px;

    box-shadow:
        0 3px 12px rgba(20, 58, 92, 0.07);
}

.medica-home-welcome-text {
    max-width: 720px;
}

.medica-home-eyebrow {
    display: block;

    margin-bottom: 6px;

    color: #148d9d;

    font-size: 12px;
    font-weight: 700;

    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.medica-home-welcome h1 {
    margin: 0 0 8px;

    color: #123d66;

    font-size: 28px;
    font-weight: 700;
}

.medica-home-welcome p {
    margin: 0;

    color: #667788;

    font-size: 14px;
    line-height: 1.6;
}


/* ---------------------------------------------------------
   SECCIÓN DE ACCESOS
   --------------------------------------------------------- */

.medica-home-section {
    margin-bottom: 26px;
}

.medica-home-section-header {
    margin-bottom: 16px;
}

.medica-home-section-header h2 {
    margin: 0 0 4px;

    color: #234a70;

    font-size: 18px;
    font-weight: 700;
}

.medica-home-section-header p {
    margin: 0;

    color: #718096;

    font-size: 13px;
}


/* ---------------------------------------------------------
   GRID PRINCIPAL
   --------------------------------------------------------- */

.medica-home-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;
}


/* ---------------------------------------------------------
   TARJETAS
   --------------------------------------------------------- */

.medica-home-card {
    position: relative;

    min-height: 125px;

    padding: 20px;

    display: flex;
    align-items: center;
    gap: 16px;

    color: #263746;

    text-decoration: none;

    background: #ffffff;

    border: 1px solid #d6e1e9;
    border-radius: 9px;

    box-shadow:
        0 2px 8px rgba(18, 57, 88, 0.06);

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.medica-home-card:visited {
    color: #263746;
}

.medica-home-card:hover {
    color: #263746;

    transform: translateY(-2px);

    border-color: #9ccbd4;

    box-shadow:
        0 7px 18px rgba(18, 57, 88, 0.11);
}


/* ---------------------------------------------------------
   ICONOS DE LAS TARJETAS
   --------------------------------------------------------- */

.medica-home-card-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: grid;
    place-items: center;

    color: #ffffff;

    background:
        linear-gradient(145deg,
            #14529d,
            #119da8);

    border-radius: 10px;

    box-shadow:
        0 3px 8px rgba(20, 82, 157, 0.18);
}

.medica-home-card-icon svg {
    width: 26px;
    height: 26px;

    display: block;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ---------------------------------------------------------
   CONTENIDO DE TARJETAS
   --------------------------------------------------------- */

.medica-home-card-content {
    min-width: 0;
    flex: 1;
}

.medica-home-card-content h3 {
    margin: 0 0 6px;

    color: #234a70;

    font-size: 15px;
    font-weight: 700;
}

.medica-home-card-content p {
    margin: 0;

    color: #6d7d8c;

    font-size: 12px;
    line-height: 1.45;
}

.medica-home-card-arrow {
    flex: 0 0 auto;

    color: #1593a0;

    font-size: 21px;
    font-weight: 600;

    transition:
        transform 0.18s ease;
}

.medica-home-card:hover .medica-home-card-arrow {
    transform: translateX(3px);
}


/* ---------------------------------------------------------
   ESTADO DEL SISTEMA
   --------------------------------------------------------- */

.medica-home-status {
    padding: 14px 18px;

    display: flex;
    align-items: center;
    gap: 12px;

    background: #edf8f4;

    border: 1px solid #c5e5d8;
    border-radius: 8px;
}

.medica-home-status-icon {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: grid;
    place-items: center;

    color: #ffffff;
    font-weight: 700;

    background: #26986b;

    border-radius: 50%;
}

.medica-home-status div:last-child {
    display: flex;
    flex-direction: column;
}

.medica-home-status strong {
    color: #24684d;

    font-size: 13px;
}

.medica-home-status span {
    margin-top: 2px;

    color: #5d7d6d;

    font-size: 12px;
}


/* =========================================================
   RESPONSIVE — PORTADA MEDICA 2.0
   ========================================================= */

@media (max-width: 1100px) {

    .medica-home-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 700px) {

    .medica-home-welcome {
        padding: 22px;
    }

    .medica-home-welcome h1 {
        font-size: 23px;
    }

    .medica-home-grid {
        grid-template-columns: 1fr;
    }

    .medica-home-card {
        min-height: 105px;
    }
}


@media (max-width: 450px) {

    .medica-home-welcome {
        padding: 18px;
    }

    .medica-home-card {
        padding: 16px;
        gap: 13px;
    }

    .medica-home-card-icon {
        width: 43px;
        height: 43px;

        flex-basis: 43px;
    }

    .medica-home-card-icon svg {
        width: 23px;
        height: 23px;
    }
}

/* =========================================================
   MEDICA 2.0
   HEADER TABLET HORIZONTAL — VERSIÓN OFICIAL 1.0

   Rango provisional:
   851px — 1100px

   Escritorio > 1100px queda intacto.
   Tablet vertical se trabajará después.
   ========================================================= */

@media (min-width: 701px) and (max-width: 1100px) {

    /* =====================================================
       HEADER GENERAL
       ===================================================== */

    .medica-header {
        width: 100% !important;

        height: 84px !important;
        min-height: 84px !important;

        overflow: hidden;
    }

    .medica-header .medica-header-inner {
        position: relative;

        width: 100%;
        max-width: none;

        height: 84px !important;
        min-height: 84px !important;

        margin: 0;

        padding: 8px 18px !important;

        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;

        gap: 14px !important;
    }


    /* =====================================================
       1. BOTÓN HAMBURGUESA
       ===================================================== */

    .medica-menu-toggle {
        display: flex !important;

        width: 46px;
        height: 46px;

        flex: 0 0 46px;

        padding: 10px;

        margin: 0;

        border-radius: 10px;
    }

    .medica-menu-toggle span {
        width: 23px;
    }


    /* =====================================================
       2. LOGO TABLET
       Más compacto que escritorio.
       ===================================================== */

    .medica-header .medica-brand {
        width: 220px !important;
        min-width: 220px !important;
        max-width: 220px !important;

        flex: 0 0 220px !important;
    }

    .medica-header .medica-brand .medica-brand-logo {
        width: 220px !important;
        min-width: 220px !important;
        max-width: 220px !important;
    }


    /* =====================================================
       3. IDENTIDAD MÉDICA
       ===================================================== */

    .medica-header .medica-header-doctor {
        min-width: 0 !important;
        max-width: 190px !important;

        flex: 1 1 180px !important;
    }


    /* Ícono de especialidad */

    .medica-header .medica-header-icon {
        display: grid !important;

        width: 42px;
        height: 42px;

        flex: 0 0 42px;

        place-items: center;
    }

    .medica-doctor-svg {
        width: 25px;
        height: 25px;
    }


    /* Nombre */

    .medica-header .medica-header-doctor-text strong {
        display: block;

        max-width: 220px;

        color: #ffffff !important;

        font-size: 15px !important;
        font-weight: 700 !important;

        line-height: 1.25;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }


    /* Especialidad */

    .medica-header .medica-header-doctor-text span {
        display: block;

        max-width: 220px;

        margin-top: 4px;

        color: rgba(225, 242, 249, 0.92) !important;

        font-size: 12px !important;
        font-weight: 400;

        line-height: 1.2;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }


    /* =====================================================
       4. FECHA
       No se muestra en tablet horizontal.
       ===================================================== */

    .medica-header .medica-header-date {
        display: none !important;
    }


    /* =====================================================
       5. HORA
       ===================================================== */

    .medica-header .medica-header-datetime {
        display: flex !important;
        align-items: center !important;

        flex: 0 0 auto !important;

        margin-left: auto !important;

        gap: 0 !important;
    }

    .medica-header .medica-header-time {
        min-width: 100px !important;
    }

    .medica-header .medica-header-exit {
        min-width: 70px !important;

        padding-left: 10px !important;
        padding-right: 10px !important;

        margin-left: 4px !important;
    }

    .medica-header .medica-header-time-icon {
        width: 38px !important;
        height: 38px !important;

        flex: 0 0 38px !important;

        display: grid !important;
        place-items: center;

        margin: 0 !important;
        padding: 0 !important;

        transform: none !important;

        border-radius: 9px;
    }

    .medica-header .medica-header-time strong {
        display: block;

        margin: 0;
        padding: 0;

        color: #ffffff !important;

        font-size: 14px !important;
        font-weight: 700 !important;

        line-height: 1.2;

        white-space: nowrap;
    }


    /* =====================================================
       6. SALIR
       ===================================================== */

    .medica-header .medica-header-exit {
        min-width: 82px !important;
        min-height: 44px !important;

        height: 44px;

        flex: 0 0 auto !important;

        margin-left: 8px !important;

        padding: 0 13px !important;

        gap: 7px;

        border-radius: 9px;
    }

    .medica-header-exit-icon {
        width: 18px;
        height: 18px;

        flex: 0 0 18px;
    }

    .medica-header-exit-icon svg {
        width: 18px;
        height: 18px;
    }

    .medica-header-exit-text {
        display: inline !important;

        position: static !important;

        width: auto !important;
        height: auto !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: visible !important;

        clip: auto !important;

        white-space: nowrap;
    }


    /* =====================================================
       CONTENIDO TABLET
       Sidebar fuera del flujo.
       ===================================================== */

    /* =====================================================
   LAYOUT TABLET — CONTENIDO A TODO EL ANCHO
   ===================================================== */

    .medica-layout {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;

        min-height: calc(100vh - 84px);
    }

    .medica-layout .medica-content {
        display: block !important;

        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;

        margin: 0 !important;
        margin-left: 0 !important;

        padding: 24px 28px !important;

        flex: none !important;

        transform: none !important;
    }


    /* =====================================================
       SIDEBAR OFF-CANVAS
       ===================================================== */

    .medica-layout .medica-sidebar {
        position: fixed;

        top: 84px;
        left: 0;
        bottom: 0;

        z-index: 990;

        width: 285px;
        max-width: 82vw;

        height: auto;
        min-height: 0;

        padding: 14px;

        overflow-y: auto;
        overflow-x: hidden;

        background: #E5E8ED;

        box-shadow:
            8px 0 24px rgba(4, 33, 61, 0.24);

        transform:
            translateX(-105%);

        transition:
            transform 0.25s ease;
    }

    .medica-layout .medica-sidebar .menu {
        width: 100%;
    }


    /* Menú abierto */

    body.menu-abierto .medica-layout .medica-sidebar {
        transform:
            translateX(0);
    }


    /* =====================================================
       CAPA OSCURA AL ABRIR EL MENÚ
       ===================================================== */

    .medica-layout::before {
        content: "";

        position: fixed;

        top: 84px;
        right: 0;
        bottom: 0;
        left: 0;

        z-index: 980;

        background:
            rgba(7, 27, 54, 0.40);

        opacity: 0;
        visibility: hidden;

        pointer-events: none;

        transition:
            opacity 0.25s ease,
            visibility 0.25s ease;
    }

    body.menu-abierto .medica-layout::before {
        opacity: 1;
        visibility: visible;

        pointer-events: auto;
    }


    /* Evitar scroll del fondo */

    body.menu-abierto {
        overflow: hidden;
    }
}

/* =========================================================
   MEDICA 2.0
   CONTROL DEFINITIVO DEL SIDEBAR RESPONSIVO
   ========================================================= */

@media (max-width: 1100px) {

    /* Estado normal: SIEMPRE cerrado */

    body:not(.menu-abierto) .medica-layout .medica-sidebar {
        transform: translateX(-105%) !important;
        visibility: hidden;
        pointer-events: none;
    }


    /* Estado abierto */

    body.menu-abierto .medica-layout .medica-sidebar {
        transform: translateX(0) !important;
        visibility: visible;
        pointer-events: auto;
    }
}

/* =========================================================
   MEDICA 2.0
   MODO EDICIÓN TABLET CON TECLADO
   ========================================================= */

@media (min-width: 701px) and (max-width: 1100px) {

    /*
     * Al editar reducimos elementos que consumen
     * altura útil.
     */

    body.modo-edicion-tablet .medica-header {
        display: none !important;
    }

    body.modo-edicion-tablet
    .medica-layout {
        min-height: 100vh !important;
    }

    body.modo-edicion-tablet
    .medica-layout
    .medica-content {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }


    /*
     * Compactamos ligeramente la tarjeta.
     */

    body.modo-edicion-tablet
    .medica-card-title {
        padding-top: 7px;
        padding-bottom: 7px;

        font-size: 15px;
    }

    body.modo-edicion-tablet
    .medica-form {
        padding-top: 8px;
        padding-bottom: 8px;
    }


    /*
     * Campo activo claramente visible.
     */

    body.modo-edicion-tablet
    .medica-form input:focus,
    body.modo-edicion-tablet
    .medica-form textarea:focus,
    body.modo-edicion-tablet
    .medica-form select:focus {
        position: relative;

        border-color: #14529D;

        box-shadow:
            0 0 0 3px
            rgba(20, 82, 157, 0.14);

        outline: none;
    }


    /*
     * Espacio de seguridad para que el navegador
     * pueda desplazar correctamente cada campo.
     */

    .medica-form input,
    .medica-form textarea,
    .medica-form select {
        scroll-margin-top: 20px;
        scroll-margin-bottom: 180px;
    }
}

/* =========================================================
   MEDICA 2.0
   TABLET VERTICAL — DISTRIBUCIÓN DEL CONTENIDO 1.0
   ========================================================= */

@media
    (max-width: 850px)
    and (orientation: portrait) {

    /* -----------------------------------------------------
       LAYOUT
       ----------------------------------------------------- */

    .medica-layout {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    /* -----------------------------------------------------
       ÁREA PRINCIPAL
       ----------------------------------------------------- */

    .medica-layout .medica-content {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        margin: 0 !important;
        margin-left: 0 !important;

        padding: 20px 22px !important;

        flex: none !important;

        transform: none !important;
    }


    /* -----------------------------------------------------
       TARJETAS / FORMULARIOS
       Aprovechan todo el ancho disponible
       ----------------------------------------------------- */

    .medica-content .medica-card,
    .medica-content .medica-card-wide {
        width: 100% !important;
        max-width: 100% !important;

        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    /* -----------------------------------------------------
       FORMULARIOS
       Una sola columna cómoda para tablet vertical
       ----------------------------------------------------- */

    .form-grid,
    .form-grid-vitals {
        grid-template-columns: 1fr !important;
    }


    /* -----------------------------------------------------
       TABLAS DE FORMULARIO CLÁSICAS
       ----------------------------------------------------- */

    .medica-table {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* -----------------------------------------------------
   SIDEBAR TABLET VERTICAL
   Fuera del flujo aunque esté cerrado
   ----------------------------------------------------- */

.medica-layout .medica-sidebar {
    position: fixed !important;

    top: 84px;
    left: 0;
    bottom: 0;

    z-index: 990;

    width: 285px !important;
    max-width: 82vw !important;

    height: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 14px !important;

    overflow-y: auto;
    overflow-x: hidden;

    transform: translateX(-105%) !important;

    visibility: hidden;
    pointer-events: none;
}

/* Sidebar abierto */

body.menu-abierto
.medica-layout
.medica-sidebar {
    transform: translateX(0) !important;

    visibility: visible;
    pointer-events: auto;
}
}

/* =========================================================
   MEDICA 2.0
   HEADER TABLET VERTICAL 1.0
   ========================================================= */

@media
    (max-width: 850px)
    and (orientation: portrait) {

    /* =====================================================
       HEADER GENERAL
       Dos niveles visuales
       ===================================================== */

    .medica-header {
        width: 100% !important;

        height: auto !important;
        min-height: 118px !important;

        overflow: hidden;
    }

    .medica-header .medica-header-inner {
        position: relative;

        width: 100% !important;
        max-width: 100% !important;

        height: auto !important;
        min-height: 118px !important;

        margin: 0 !important;
        padding: 10px 16px 9px !important;

        display: grid !important;

        grid-template-columns:
            52px
            minmax(0, 1fr)
            48px;

        grid-template-rows:
            62px
            36px;

        column-gap: 10px !important;
        row-gap: 0 !important;

        align-items: center;
    }


    /* =====================================================
       HAMBURGUESA
       ===================================================== */

    .medica-menu-toggle {
        grid-column: 1;
        grid-row: 1;

        display: flex !important;

        width: 46px !important;
        height: 46px !important;

        min-width: 46px !important;

        margin: 0 !important;
        padding: 10px !important;

        justify-self: start;
        align-self: center;

        flex: none !important;
    }

    .medica-menu-toggle span {
        width: 23px !important;
    }


    /* =====================================================
       LOGO
       ===================================================== */

    .medica-header .medica-brand {
        grid-column: 2;
        grid-row: 1;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 360px !important;

        height: 58px !important;

        margin: 0 !important;
        padding: 0 !important;

        justify-self: start;

        display: flex !important;
        align-items: center;

        flex: none !important;

        overflow: hidden;
    }

    .medica-header
    .medica-brand
    .medica-brand-logo {
        display: block !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;

        height: 58px !important;
        min-height: 0 !important;
        max-height: 58px !important;

        margin: 0 !important;
        padding: 0 !important;

        object-fit: contain !important;
        object-position: left center !important;
    }


    /* =====================================================
       SALIR
       Icono compacto en vertical
       ===================================================== */

    .medica-header .medica-header-exit {
        grid-column: 3;
        grid-row: 1;

        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;

        height: 44px !important;
        min-height: 44px !important;

        margin: 0 !important;
        padding: 0 !important;

        justify-self: end;
        align-self: center;

        display: flex !important;
        align-items: center;
        justify-content: center;

        flex: none !important;

        border-radius: 9px;
    }

    .medica-header-exit-icon {
        width: 20px !important;
        height: 20px !important;

        flex: 0 0 20px !important;

        display: grid;
        place-items: center;
    }

    .medica-header-exit-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Ocultamos solamente la palabra Salir */

    .medica-header-exit-text {
        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;

        white-space: nowrap !important;

        border: 0 !important;
    }


    /* =====================================================
       MÉDICO
       Segunda línea
       ===================================================== */

    .medica-header .medica-header-doctor {
        grid-column: 2 / 4;
        grid-row: 2;

        position: static !important;

        left: auto !important;
        top: auto !important;

        transform: none !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;

        height: 34px;

        margin: 0 !important;
        padding: 0 !important;

        display: flex !important;
        align-items: center;
        justify-content: flex-start;

        gap: 8px !important;

        border-left: none !important;

        flex: none !important;
    }


    /* Ícono de especialidad */

    .medica-header .medica-header-icon {
        display: grid !important;

        width: 30px !important;
        height: 30px !important;

        flex: 0 0 30px !important;

        place-items: center;

        margin: 0 !important;

        background:
            rgba(255, 255, 255, 0.08);

        border:
            1px solid rgba(255, 255, 255, 0.15);

        border-radius: 50%;
    }

    .medica-doctor-svg {
        width: 20px !important;
        height: 20px !important;
    }


    /* Texto médico */

    .medica-header
    .medica-header-doctor-text {
        min-width: 0 !important;

        display: flex !important;
        flex-direction: row !important;
        align-items: baseline !important;

        gap: 7px !important;

        line-height: 1.15;
    }


    /* Nombre */

    .medica-header
    .medica-header-doctor-text strong {
        display: block;

        max-width: none !important;

        margin: 0 !important;

        color: #ffffff !important;

        font-size: 13px !important;
        font-weight: 700 !important;

        line-height: 1.15;

        white-space: nowrap !important;

        overflow: visible !important;
        text-overflow: clip !important;
    }


    /* Especialidad */

    .medica-header
    .medica-header-doctor-text span {
        display: block !important;

        max-width: none !important;

        margin: 0 !important;

        color:
            rgba(225, 242, 249, 0.90) !important;

        font-size: 11px !important;
        font-weight: 400 !important;

        line-height: 1.15;

        white-space: nowrap !important;

        overflow: visible !important;
        text-overflow: clip !important;
    }


    /* =====================================================
       FECHA Y HORA
       Se ocultan en tablet vertical
       ===================================================== */

    .medica-header .medica-header-datetime {
        display: none !important;
    }
}

/* =========================================================
   MEDICA 2.0
   SIDEBAR — POSICIÓN DINÁMICA EN VERTICAL
   ========================================================= */

@media
    (max-width: 850px)
    and (orientation: portrait) {

    .medica-layout .medica-sidebar {

        top:
            var(
                --medica-header-real-height,
                118px
            ) !important;

        bottom: 0 !important;

        height: auto !important;
        min-height: 0 !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;

        -webkit-overflow-scrolling: touch;
    }


    /*
     * La capa oscura también comienza
     * exactamente debajo del header.
     */

    .medica-layout::before {

        top:
            var(
                --medica-header-real-height,
                118px
            ) !important;
    }
}

/* =========================================================
   MEDICA 2.0
   RESPUESTAS DEL SISTEMA — GUARDADO DE DATOS
   ========================================================= */

.medica-response-card {
    max-width: 720px;
}

.medica-response-body {
    padding: 38px 42px 34px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
}


/* ---------------------------------------------------------
   ICONO DE ESTADO
   --------------------------------------------------------- */

.medica-response-icon {
    width: 72px;
    height: 72px;

    display: grid;
    place-items: center;

    margin-bottom: 18px;

    color: #ffffff;

    font-size: 36px;
    font-weight: 700;

    border-radius: 50%;

    box-shadow:
        0 5px 14px rgba(18, 57, 88, 0.16);
}

.medica-response-icon-success {
    background: #26986b;
}

.medica-response-icon-error {
    background: #cf3f3f;
}


/* ---------------------------------------------------------
   TEXTO
   --------------------------------------------------------- */

.medica-response-title {
    margin: 0 0 10px;

    color: #234a70;

    font-size: 24px;
    font-weight: 700;

    line-height: 1.25;
}

.medica-response-message {
    max-width: 540px;

    margin: 0 0 24px;

    color: #5d6d7e;

    font-size: 15px;
    line-height: 1.55;
}

.medica-response-message-error {
    color: #a02f2f;
}


/* ---------------------------------------------------------
   RESUMEN DEL REGISTRO
   --------------------------------------------------------- */

.medica-response-summary {
    width: 100%;
    max-width: 500px;

    margin-bottom: 28px;

    background: #f6f9fb;

    border: 1px solid #d8e2e9;
    border-radius: 8px;

    overflow: hidden;
}

.medica-response-summary-row {
    padding: 13px 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    border-bottom: 1px solid #dfe7ed;
}

.medica-response-summary-row:last-child {
    border-bottom: none;
}

.medica-response-summary-row span {
    color: #6a7886;

    font-size: 13px;
}

.medica-response-summary-row strong {
    color: #234a70;

    font-size: 14px;
    font-weight: 700;

    text-align: right;
}


/* ---------------------------------------------------------
   ACCIONES
   --------------------------------------------------------- */

.medica-response-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;

    gap: 12px;
}


/* =========================================================
   RESPUESTAS — MÓVIL
   ========================================================= */

@media (max-width: 620px) {

    .medica-response-body {
        padding: 30px 22px 26px;
    }

    .medica-response-icon {
        width: 64px;
        height: 64px;

        font-size: 32px;
    }

    .medica-response-title {
        font-size: 21px;
    }

    .medica-response-summary-row {
        flex-direction: column;
        align-items: flex-start;

        gap: 4px;

        text-align: left;
    }

    .medica-response-summary-row strong {
        text-align: left;
    }

    .medica-response-actions {
        width: 100%;
        flex-direction: column;
    }

    .medica-response-actions .btn {
        width: 100%;

        display: flex;
        align-items: center;
        justify-content: center;
    }
}
/* =========================================================
   MEDICA 2.0 - ALTA DE PACIENTE EN CURSO
   Bloqueo temporal del menú lateral
   ========================================================= */

.medica-layout .medica-sidebar.medica-sidebar-bloqueado {
    opacity: 0.42;
    pointer-events: none !important;
    filter: grayscale(35%);
    cursor: not-allowed;
    user-select: none;
}

/* =========================================================
   MEDICA 2.0 - ALTA DE PACIENTE EN CURSO
   Bloqueo de accesos rápidos de Inicio
   Solo "Continuar Alta de Paciente" permanece habilitado
   ========================================================= */

.medica-home-grid-alta-pendiente
.medica-home-card:not(.medica-home-card-continuar) {
    opacity: 0.42;
    pointer-events: none !important;
    filter: grayscale(35%);
    cursor: not-allowed;
    user-select: none;
}

