:root {
    color-scheme: light;
    font-family: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172536;
    background: #f3f7fb;
    font-synthesis: none;
    --ink: #172536;
    --muted: #526579;
    --primary: #173a63;
    --primary-hover: #0f2d4e;
    --line: #d4dfea;
    --surface: #ffffff;
    --surface-soft: #f3f7fb;
    --focus: #2d6fae;
    --danger: #a52820;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #f3f7fb;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 15% 0%, rgb(255 255 255 / 95%) 0 18rem, transparent 42rem),
        linear-gradient(145deg, #f8fbfe 0%, #edf3f9 100%);
}

a {
    color: var(--primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 20;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    background: var(--ink);
    color: white;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.identity-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

.site-header,
.site-footer {
    width: min(100% - 2rem, 72rem);
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 5rem;
    gap: 1rem;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--primary);
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.wordmark-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.4rem;
    background: var(--primary);
    color: white;
    font-family: Georgia, serif;
    font-size: 1.15rem;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #8090a2;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.language-switcher a {
    padding: 0.4rem;
    text-decoration: none;
}

.identity-main {
    display: grid;
    place-items: center;
    width: 100%;
    padding: 1.25rem 1rem 3rem;
}

.identity-card {
    width: min(100%, 29rem);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 1.25rem 3.5rem rgb(23 58 99 / 10%);
}

.identity-card--welcome {
    padding-block: clamp(2rem, 7vw, 3.25rem);
}

.eyebrow {
    margin-bottom: 0.9rem;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h1,
h2,
p {
    overflow-wrap: anywhere;
}

h1,
h2 {
    color: var(--ink);
    letter-spacing: -0.035em;
}

h1 {
    margin: 0;
    font-size: clamp(1.75rem, 8vw, 2.45rem);
    line-height: 1.08;
}

.identity-main h1:focus {
    outline: none;
}

h2 {
    margin: 1.25rem 0 0.65rem;
    font-size: 1.35rem;
}

.lead {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

.action-stack {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    font: inherit;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button--primary {
    background: var(--primary);
    color: white;
}

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

.button--secondary {
    border-color: #b9c9d9;
    background: white;
    color: var(--primary);
}

.button--secondary:hover {
    border-color: var(--primary);
    background: #f8fbfe;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.text-link {
    display: inline-block;
    margin-top: 1.25rem;
    font-weight: 700;
    text-underline-offset: 0.2em;
}

.privacy-note {
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
}

.notice {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid #c8d8e8;
    border-radius: 0.35rem;
    background: #f2f7fc;
}

.notice--error {
    border-color: #e4b7b3;
    background: #fff5f4;
}

.notice-icon {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
}

.notice--error .notice-icon {
    background: var(--danger);
}

.notice strong {
    display: block;
    margin-bottom: 0.2rem;
}

.notice p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

form {
    margin-top: 1.75rem;
}

.field {
    margin-bottom: 1.25rem;
}

label,
.setup-key-block > span {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 750;
}

input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #aebfd0;
    border-radius: 0.3rem;
    background: white;
    color: var(--ink);
    font: inherit;
}

.field-help {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.validation-message,
.form-error {
    color: var(--danger);
    font-size: 0.88rem;
}

.form-error {
    margin: 1rem 0 0;
}

.setup-key-block {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    background: var(--surface-soft);
}

.setup-key-block code {
    color: var(--ink);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.loading-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    color: var(--muted);
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.success-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: #e7f4ed;
    color: #176b43;
    font-size: 1.5rem;
    font-weight: 800;
}

.site-footer {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    padding: 1.25rem 1rem 2rem;
    color: #6f8091;
    font-size: 0.78rem;
}

.blazor-error-boundary {
    margin: 1rem;
    padding: 1rem;
    border-radius: 0.3rem;
    background: #8c211b;
    color: white;
}

.blazor-error-boundary::after {
    content: "La conexión se ha interrumpido.";
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 48rem) {
    .identity-main {
        padding-block: 2rem 4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
