:root {
    color-scheme: light dark;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #eef1f5;
    --text: #16202b;
    --text-muted: #55616f;
    --border: #d5dbe3;
    --accent: #0f5e54;
    --accent-text: #ffffff;
    --accent-soft: #e2f0ec;
    --danger: #a3231f;
    --danger-soft: #fbe9e8;
    --focus: #1f7a8c;

    --radius: 12px;
    --space: 1rem;
    --max-width: 68rem;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #10151a;
        --surface: #171f26;
        --surface-muted: #1e2831;
        --text: #e8edf2;
        --text-muted: #a4b1bd;
        --border: #2d3a45;
        --accent: #5cc9b6;
        --accent-text: #06231f;
        --accent-soft: #16302c;
        --danger: #ff8f8a;
        --danger-soft: #33191a;
        --focus: #7fd8c9;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    min-height: 100vh;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-header,
.site-footer {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: inherit;
    text-decoration: none;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 700;
}

.brand-suffix {
    color: var(--text-muted);
    font-weight: 500;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.language-switch a {
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}

.language-switch a:hover,
.language-switch a:focus-visible {
    background: var(--surface-muted);
    color: var(--text);
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text);
    text-decoration: underline;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-footer p {
    margin: 0;
}

.auth-layout {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

@media (min-width: 56rem) {
    .auth-layout {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 4vw, 2rem);
}

.panel-narrow {
    max-width: 34rem;
    margin: 0 auto;
}

.panel-muted {
    background: var(--surface-muted);
}

.panel-danger {
    border-color: var(--danger);
}

.eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.015em;
}

h2 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1.05rem;
}

.panel > h2:first-of-type {
    margin-top: 1.5rem;
}

p {
    margin: 0 0 1rem;
}

.lead {
    color: var(--text-muted);
    font-size: 1.02rem;
}

.small,
.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.input {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

.field-error,
.validation-message {
    display: block;
    margin-top: 0.3rem;
    color: var(--danger);
    font-size: 0.85rem;
}

.validation-summary-errors ul {
    margin: 0 0 1rem;
    padding: 0.75rem 0.75rem 0.75rem 1.75rem;
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.9rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent-text);
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

.button:hover {
    filter: brightness(1.05);
}

.button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.button-block {
    width: 100%;
    margin-top: 0.5rem;
}

.button-secondary {
    color: var(--text);
    background: var(--surface-muted);
    border-color: var(--border);
}

.button-danger {
    background: var(--danger);
    color: var(--surface);
}

@media (prefers-color-scheme: dark) {
    .button-danger {
        color: #2a0d0d;
    }
}

.alert {
    padding: 0.75rem 0.9rem;
    margin: 0 0 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-info {
    background: var(--accent-soft);
    color: var(--text);
}

.notice {
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
    font-size: 0.92rem;
}

.notice p {
    margin: 0;
}

.link-list {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    font-size: 0.92rem;
}

.link-list a {
    color: var(--accent);
    text-decoration: none;
}

.link-list a:hover,
.link-list a:focus-visible {
    text-decoration: underline;
}

.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.35rem 1rem;
    margin: 1.25rem 0;
    font-size: 0.92rem;
}

.facts dt {
    color: var(--text-muted);
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

code {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
    font-size: 0.85em;
    background: var(--surface-muted);
    padding: 0.15rem 0.35rem;
    border-radius: 5px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.authenticator-key code {
    display: block;
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
    letter-spacing: 0.08em;
    overflow-wrap: anywhere;
}

.code-list {
    display: grid;
    gap: 0.4rem;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    margin: 1rem 0;
    padding: 0;
    list-style: none;
}

.code-list code {
    display: block;
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
    text-align: center;
}

a {
    color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
