:root {
    --identity-background: #1e293b;
    --identity-surface: #ffffff;
    --identity-border: #d7dee8;
    --identity-text: #334155;
    --identity-muted: #64748b;
    --identity-primary: #2563eb;
    --identity-primary-hover: #1d4ed8;
    --identity-danger: #dc2626;
    --identity-danger-background: #fef2f2;
    --identity-danger-border: #fecaca;
    --identity-success: #047857;
    --identity-success-background: #ecfdf5;
    --identity-success-border: #a7f3d0;
    --identity-info: #1d4ed8;
    --identity-info-background: #eff6ff;
    --identity-info-border: #bfdbfe;
    --identity-warning: #b45309;
    --identity-warning-background: #fffbeb;
    --identity-warning-border: #fde68a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Tipografía general del módulo Identity */
html,
body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    color: var(--identity-text);
}

/* Los controles y elementos del login heredan la misma tipografía */
.identity-auth,
.identity-auth input,
.identity-auth button,
.identity-auth select,
.identity-auth textarea,
.identity-auth label,
.identity-auth a {
    font-family: inherit;
}

.identity-auth {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    background: var(--identity-background);
}

.identity-auth__container {
    width: 100%;
    max-width: 36rem;
}

.identity-card {
    overflow: hidden;
    border: 1px solid var(--identity-border);
    border-radius: 0.75rem;
    background: var(--identity-surface);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.3);
}

.identity-card__header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--identity-border);
    text-align: center;
}

.identity-card__logo {
    display: block;
    width: auto;
    height: 7rem;
    margin: 0 auto;
}

.identity-card__body {
    padding: 1.75rem 2rem 2rem;
}

.identity-alert {
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    font-size: 0.9rem;
    line-height: 1.45;
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.35s ease,
        transform 0.35s ease,
        background-color 0.35s ease,
        border-color 0.35s ease,
        color 0.35s ease;
}

.identity-alert--success {
    color: var(--identity-success);
    background: var(--identity-success-background);
    border-color: var(--identity-success-border);
}

.identity-alert--danger {
    color: var(--identity-danger);
    background: var(--identity-danger-background);
    border-color: var(--identity-danger-border);
}

.identity-alert--info {
    color: var(--identity-info);
    background: var(--identity-info-background);
    border-color: var(--identity-info-border);
}

.identity-alert--warning {
    color: var(--identity-warning);
    background: var(--identity-warning-background);
    border-color: var(--identity-warning-border);
}

.identity-alert__content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.identity-alert__icon {
    display: block;
    flex: 0 0 1.15rem;
    width: 1.15rem;
    height: 1.15rem;
    color: currentColor;
}

.identity-alert__text {
    flex: 1;
}

.identity-alert.is-hiding {
    opacity: 0;
    transform: translateY(-0.35rem);
}

.identity-alert__title {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.identity-alert__list {
    margin: 0;
    padding-left: 1.25rem;
}

.identity-form__group {
    margin-bottom: 1rem;
}

.identity-form__label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--identity-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.identity-form__control {
    width: 100%;
    min-height: 2.85rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.45rem;
    background: #ffffff;
    color: var(--identity-text);
    font-size: 1rem;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.identity-form__control:focus {
    border-color: var(--identity-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.identity-form__control.is-invalid {
    border-color: var(--identity-danger);
}

.identity-form__control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.identity-form__error {
    margin-top: 0.35rem;
    color: var(--identity-danger);
    font-size: 0.82rem;
}

.identity-form__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0;
}

.identity-form__remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--identity-text);
    font-size: 0.9rem;
}

.identity-form__link {
    color: var(--identity-primary);
    font-size: 0.9rem;
    text-decoration: none;
}

.identity-form__link:hover {
    text-decoration: underline;
}

.identity-form__button {
    width: 100%;
    min-height: 2.85rem;
    padding: 0.7rem 1rem;
    border: 0;
    border-radius: 0.45rem;
    background: var(--identity-primary);
    color: #ffffff;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition:
        background 0.2s ease,
        opacity 0.2s ease;
}

.identity-form__button:hover {
    background: var(--identity-primary-hover);
}

.identity-form__button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.identity-turnstile {
    margin-top: 0.5rem;
}

@media (max-width: 640px) {
    .identity-auth {
        align-items: flex-start;
        padding: 1rem;
    }

    .identity-card__header {
        padding: 1.25rem;
    }

    .identity-card__logo {
        height: 5.75rem;
    }

    .identity-card__body {
        padding: 1.25rem;
    }

    .identity-form__options {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .identity-alert,
    .identity-form__control,
    .identity-form__button {
        transition: none;
    }
}

/* Acciones del formulario de recuperación */
.identity-form__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.identity-form__actions .identity-form__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.85rem;
    text-align: center;
    text-decoration: none;
}

/* Botón secundario */
.identity-form__button--secondary {
    background: #64748b;
    color: #ffffff;
}

.identity-form__button--secondary:hover {
    background: #475569;
}

/* Alerta compacta */
.identity-alert--compact {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* Ajuste para Turnstile */
.identity-turnstile {
    margin-top: 0.5rem;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 640px) {
    .identity-form__actions {
        grid-template-columns: 1fr;
    }
}