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

:root {
    --azul:        #0079C8;
    --azul-hover:  #0067ab;
    --navy:        #0D1846;
    --gris-calido: #F1EFEB;
    --rojo:        #E53935;
    --fondo:       #EAF1F8;
    --texto:       #0D1846;
    --gris-label:  #44546a;
    --gris-borde:  #d6dee8;
    --gris-campo:  #f6f5f2;
    --font:        Tahoma, Verdana, Segoe, 'Segoe UI', Arial, sans-serif;
}

html, body {
    height: 100%;
}

html {
    overflow-x: clip;
    overflow-y: auto;
}

body {
    font-family: var(--font);
    background: var(--fondo);
    color: var(--texto);
    position: relative;
}

input, button, textarea, select {
    font-family: var(--font);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    font-family: var(--font);
    -webkit-text-fill-color: var(--texto);
    -webkit-box-shadow: 0 0 0 1000px var(--gris-campo) inset;
    caret-color: var(--texto);
}

form {
    min-height: 100vh;
}

/* ---- Animacion de entrada ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Layout split ---- */
.split {
    display: flex;
    min-height: 100vh;
}

/* Panel de marca (izquierda) */
.brand {
    flex: 1 1 46%;
    background: linear-gradient(155deg, var(--azul) 0%, #0a5ca0 55%, var(--navy) 100%);
    color: #fff;
    padding: 54px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.brand::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
    bottom: -160px;
    right: -140px;
    pointer-events: none;
}

.brand-logo {
    z-index: 1;
}

.brand-logo img {
    height: 44px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

.brand-fallback {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.brand-copy {
    z-index: 1;
}

.brand-copy h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    max-width: 340px;
    letter-spacing: -0.5px;
}

.brand-copy p {
    margin-top: 16px;
    max-width: 330px;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .8);
    font-weight: 400;
}

.brand-foot {
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brand-back {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    opacity: .9;
}

.brand-back:hover {
    opacity: 1;
    text-decoration: underline;
}

.brand-foot small {
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}

/* Panel de formulario (derecha) */
.panel {
    flex: 1 1 54%;
    background: var(--fondo);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
}

.back-top {
    position: absolute;
    top: 24px;
    right: 32px;
    color: var(--azul);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.back-top:hover {
    text-decoration: underline;
}

/* Copyright solo visible en movil (oculto en desktop) */
.copy-mobile {
    display: none;
}

.card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(13,24,70,.04), 0 20px 60px rgba(13,24,70,.12);
    padding: 36px 32px;
    animation: fadeUp 0.4s ease both;
}

.card h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.card .subtitle {
    color: #6b7a8d;
    font-size: 14px;
    margin-bottom: 28px;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid #e3e9f0;
    margin-bottom: 26px;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 4px;
    font-size: 15px;
    font-weight: 600;
    color: #8a98a8;
    cursor: pointer;
    position: relative;
    font-family: var(--font);
    transition: color 0.2s;
}

.tab:hover {
    color: var(--azul);
}

.tab.active {
    color: var(--azul);
}

.tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: var(--azul);
    border-radius: 3px 3px 0 0;
}

/* ---- Campos ---- */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-label);
    margin-bottom: 7px;
    letter-spacing: 0.1px;
}

.field label .req {
    color: var(--rojo);
}

.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    font-family: var(--font);
    font-size: 15px;
    border: 1.5px solid var(--gris-borde);
    border-radius: 9px;
    background: var(--gris-campo);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    color: var(--texto);
}

.field input:focus {
    outline: none;
    border-color: var(--azul);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0,121,200,.12);
}

.field input::placeholder {
    font-family: var(--font);
    color: #9aa7b4;
    font-weight: 400;
}

.pwd-wrap {
    position: relative;
}

.pwd-wrap input {
    padding-right: 46px !important;
}

.pwd-wrap input::-ms-reveal,
.pwd-wrap input::-ms-clear {
    display: none;
}

.pwd-wrap input::-webkit-credentials-auto-fill-button,
.pwd-wrap input::-webkit-strong-password-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

.toggle-eye {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #8a98a8;
    display: flex;
    padding: 0;
    transition: color 0.2s;
}

.toggle-eye:hover {
    color: var(--azul);
}

/* ---- Captcha ---- */
.captcha {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    zoom: 0.95;
}

/* ---- Boton ---- */
.btn {
    width: 100%;
    padding: 14px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--azul) 0%, #0067ab 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(0,121,200,.35);
    transition: box-shadow 0.2s, transform 0.05s, background 0.2s;
}

.btn:hover {
    background: linear-gradient(135deg, #008ae0 0%, var(--azul) 100%);
    box-shadow: 0 6px 18px rgba(0,121,200,.4);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0,121,200,.3);
}

.btn:disabled {
    background: #b9cfe0;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* ---- Mensaje error ---- */
.msg-error {
    background: #fdecec;
    color: #c0392b;
    border: 1px solid #f5c6c6;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}

/* ---- Guia web (solo paciente) ---- */
.guia {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 11px 13px;
    background: #eaf4fb;
    border: 1px solid #cfe6f7;
    border-radius: 8px;
    font-size: 12.5px;
    color: #44546a;
}

.guia svg {
    color: var(--azul);
    flex-shrink: 0;
}

.guia a {
    color: var(--azul);
    font-weight: 700;
    text-decoration: none;
}

.guia a:hover {
    text-decoration: underline;
}

/* Pantallas bajas en desktop: evita que el card tape el link de volver */
@media (max-height: 660px) and (min-width: 821px) {
    .panel {
        align-items: flex-start;
        padding-top: 60px;
    }
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
    .split { flex-direction: column; }

    .brand {
        flex: none;
        padding: 18px 24px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .brand::after { display: none; }
    .brand-copy  { display: none; }
    .brand-foot  { display: none; }

    .panel {
        padding: 58px 24px 56px;
    }

    .back-top {
        top: 14px;
        right: 20px;
        font-size: 14px;
        background: rgba(255, 255, 255, .9);
        border: 1px solid var(--gris-borde);
        border-radius: 8px;
        padding: 5px 12px;
        backdrop-filter: blur(4px);
    }

    .back-top:hover { text-decoration: none; opacity: .85; }

    .copy-mobile {
        display: block;
        position: absolute;
        bottom: 24px;
        left: 0;
        right: 0;
        text-align: center;
        color: rgba(13, 24, 70, .45);
        font-size: 13px;
    }

    .guia { justify-content: center; }

    .card { padding: 28px 24px; border-radius: 14px; width: 100%; }
    .card h2 { font-size: 22px; }
}

@media (max-width: 480px) {
    .brand { padding: 16px 20px; }

    .panel { padding: 54px 16px 56px; }

    .back-top { top: 12px; right: 16px; padding: 4px 10px; }

    .card { padding: 22px 16px; }

    .tab { font-size: 14px; padding: 10px 2px; }

    .captcha { zoom: 0.85; }
}

@media (max-width: 390px) {
    .panel { padding: 54px 12px 56px; }
    .card { padding: 20px 12px; }
    .captcha { zoom: 0.85; }
}

@media (max-width: 365px) {
    .panel { padding: 54px 10px 56px; }
    .card { padding: 20px 10px; }
}

@media (max-width: 325px) {
    .panel { padding: 54px 4px 56px; }
    .card { padding: 18px 16px; }
    .captcha { zoom: 0.85; }
}
