* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #F3F4F6;
    --ledger-line: #E7E9EC;
    --surface: #FFFFFF;
    --border: #E1E3E7;
    --border-strong: #C7CBD1;
    --text: #1C1F23;
    --text-secondary: #6B7280;
    --text-faint: #9AA0A8;
    --red: #B3202E;
    --red-dark: #8C1622;
    --red-tint: #FBEAEC;
    --blue: #2E55A3;
    --field-bg: #F7F8F9;
    --radius: 16px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
    --transition: 0.25s cubic-bezier(0.2, 0, 0, 1);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', 'Montserrat', system-ui, -apple-system, sans-serif;
    padding: 24px 16px;
    color: var(--text);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
}

/* ===== FONDO CON DEGRADADO ANIMADO ===== */
.background-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #f5f7fa, #e8ecf1, #dce1e9, #f0f2f5);
    background-size: 400% 400%;
    animation: gradientShift 15s ease-in-out infinite;
}

/* Degradado alternativo con rojos sutiles */
.background-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(179, 32, 46, 0.05) 0%, 
        rgba(255, 255, 255, 0) 30%,
        rgba(140, 22, 34, 0.05) 60%,
        rgba(255, 255, 255, 0) 80%,
        rgba(179, 32, 46, 0.03) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift2 20s ease-in-out infinite;
    pointer-events: none;
}

/* ===== ANIMACIONES ===== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 0%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 100%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes gradientShift2 {
    0% {
        background-position: 0% 50%;
        opacity: 0.3;
    }
    33% {
        background-position: 50% 100%;
        opacity: 0.8;
    }
    66% {
        background-position: 100% 50%;
        opacity: 0.3;
    }
    100% {
        background-position: 0% 50%;
        opacity: 0.5;
    }
}

/* ===== TARJETA CON EFECTO CRISTAL ===== */
.sheet {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.form-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 10px 30px -10px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

.form-card:hover {
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.12),
        0 15px 40px -10px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.letterhead {
    background: var(--red);
    background-image: linear-gradient(145deg, var(--red) 0%, var(--red-dark) 100%);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.letterhead::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

.letterhead::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    pointer-events: none;
}

.letterhead img {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.letterhead h1 {
    margin: 0;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #FFFFFF;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.letterhead p {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.2px;
    position: relative;
    z-index: 1;
}

form {
    padding: 32px 28px 28px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
}

label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
    margin-left: 2px;
}

.field-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon .input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    stroke: var(--text-faint);
    stroke-width: 1.8;
    fill: none;
    pointer-events: none;
    transition: stroke var(--transition);
    z-index: 1;
}

.field-icon:focus-within .input-icon {
    stroke: var(--red);
}

.field-icon input {
    width: 100%;
    font-family: 'Inter', 'Montserrat', system-ui, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    background-color: rgba(247, 248, 249, 0.7);
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    padding: 14px 48px 14px 44px;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
    line-height: 1.4;
}

input::placeholder {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 15px;
    opacity: 0.75;
}

input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(179, 32, 46, 0.10);
    background-color: #FFFFFF;
}

input.input-error {
    border-color: var(--red);
    background-color: var(--red-tint);
    box-shadow: 0 0 0 3px rgba(179, 32, 46, 0.06);
}

.error-msg {
    font-size: 13px;
    font-weight: 500;
    color: var(--red);
    min-height: 20px;
    margin-top: 2px;
    letter-spacing: 0.1px;
}

.toggle-visibility {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background var(--transition), color var(--transition);
    width: 32px;
    height: 32px;
    z-index: 1;
}

.toggle-visibility:hover {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
}

.toggle-visibility svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    display: block;
}

.field-icon input[type="password"] {
    padding-right: 52px;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 26px;
    flex-wrap: wrap;
    gap: 8px 6px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox-line input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--red);
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.1s;
}

.checkbox-line input[type="checkbox"]:hover {
    transform: scale(1.03);
}

.checkbox-line label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.link {
    font-size: 14px;
    font-weight: 600;
    color: var(--red);
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition);
    letter-spacing: 0.1px;
}

.link:hover {
    color: var(--red-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.btn {
    width: 100%;
    font-family: 'Montserrat', 'Inter', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
    padding: 16px 20px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s, box-shadow var(--transition);
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--red);
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(179, 32, 46, 0.15);
}

.btn-primary:hover {
    background: var(--red-dark);
    box-shadow: 0 8px 18px rgba(179, 32, 46, 0.25);
    transform: scale(1.01);
}

.btn-primary:active {
    transform: scale(0.98);
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 26px 0 20px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1.5px;
    background-color: var(--border);
    opacity: 0.7;
}

.divider span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    padding: 0 6px;
}

.footnote {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

.footnote a {
    color: var(--red);
    font-weight: 700;
    text-decoration: none;
    transition: color var(--transition), text-decoration var(--transition);
}

.footnote a:hover {
    color: var(--red-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 480px) {
    body {
        padding: 16px 12px;
    }

    .letterhead {
        padding: 26px 20px;
    }

    .letterhead h1 {
        font-size: 24px;
    }

    .letterhead p {
        font-size: 14px;
    }

    .letterhead img {
        width: 60px !important;
        height: 60px !important;
    }

    form {
        padding: 24px 18px 22px;
    }

    .field-icon input {
        font-size: 15px;
        padding: 13px 46px 13px 40px;
    }

    .field-icon .input-icon {
        left: 12px;
        width: 18px;
        height: 18px;
    }

    .toggle-visibility {
        right: 8px;
        width: 28px;
        height: 28px;
    }

    .toggle-visibility svg {
        width: 18px;
        height: 18px;
    }

    .field-icon input[type="password"] {
        padding-right: 46px;
    }

    .btn {
        font-size: 16px;
        padding: 15px 18px;
    }

    .row-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 22px;
    }

    .checkbox-line label {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .letterhead h1 {
        font-size: 21px;
    }

    .letterhead img {
        width: 50px !important;
        height: 50px !important;
    }
}

input:focus-visible,
button:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}