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

html,
body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1f2d45;
    -webkit-font-smoothing: antialiased;
}

.auth-backdrop {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    background-color: #0b336e;
    background-image:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.06) 0%,
            rgba(255, 255, 255, 0.06) 24%,
            transparent 24%,
            transparent 44%,
            rgba(255, 255, 255, 0.04) 44%,
            rgba(255, 255, 255, 0.04) 64%,
            transparent 64%,
            transparent 100%
        ),
        linear-gradient(145deg, #103c7f 0%, #0b336e 48%, #072656 100%);
}

.card-stack {
    position: relative;
    width: 100%;
    max-width: 470px;
    margin-top: 24px;
}

.card-stack--wide {
    max-width: 560px;
}

.card-stack::before,
.card-stack::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 4px 4px 0 0;
    pointer-events: none;
}

/* Capa superior (más lejana) */
.card-stack::before {
    top: -28px;
    width: calc(100% - 64px);
    height: 15px;
    background: rgba(255, 255, 255, 0.24);
}

/* Capa intermedia */
.card-stack::after {
    top: -14px;
    width: calc(100% - 28px);
    height: 14px;
    background: rgba(255, 255, 255, 0.62);
}

.auth-card {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 5px;
    padding: 44px 44px 42px;
    box-shadow: 0 20px 50px rgba(4, 18, 46, 0.42);
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-logo img {
    width: 58px;
    height: auto;
    display: block;
}

.auth-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #24334a;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    font-size: 0.875rem;
    color: #708096;
    margin-bottom: 30px;
    line-height: 1.45;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    font-size: 0.92rem;
    color: #1f2d45;
    background: #ffffff;
    border: 1px solid #d7dee8;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control::placeholder {
    color: #9ba7b8;
}

.form-control:focus {
    border-color: #0d52bd;
    box-shadow: 0 0 0 3px rgba(13, 82, 189, 0.14);
}

.password-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.password-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.btn-toggle-password {
    width: 48px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #0d52bd;
    color: #ffffff;
    border: 1px solid #0d52bd;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.btn-toggle-password:hover {
    background-color: #0a44a0;
}

.btn-toggle-password:focus-visible {
    outline: 2px solid #0d52bd;
    outline-offset: 2px;
}

.btn-primary {
    width: 100%;
    height: 44px;
    margin-top: 8px;
    background-color: #0d52bd;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(13, 82, 189, 0.32);
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary:hover {
    background-color: #0a44a0;
    box-shadow: 0 6px 16px rgba(13, 82, 189, 0.38);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 42px;
    margin-top: 10px;
    background-color: #f1f5f9;
    color: #24334a;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #d7dee8;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.field-validation-error {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #c53030;
}

.validation-summary-errors {
    margin-bottom: 18px;
    padding: 10px 14px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 4px;
    color: #c53030;
    font-size: 0.84rem;
}

.validation-summary-errors ul {
    list-style: none;
}

/* Vista de token emitido */
.claims-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.claim-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px 12px;
}

.claim-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 3px;
}

.claim-value {
    font-size: 0.86rem;
    font-weight: 600;
    color: #1e293b;
    word-break: break-all;
}

.token-box {
    width: 100%;
    min-height: 124px;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    resize: vertical;
    word-break: break-all;
}

.copy-feedback {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #15803d;
    min-height: 18px;
}

@media (max-width: 520px) {
    .auth-card {
        padding: 34px 24px 32px;
    }

    .claims-grid {
        grid-template-columns: 1fr;
    }
}
