:root {
    color-scheme: light dark;
    --fe-bg: #f3f4f6;
    --fe-surface: #ffffff;
    --fe-text: #111827;
    --fe-text-muted: #475569;
    --fe-border: #e5e7eb;
    /* Brand red: keep in sync with UNFOLD["COLORS"]["primary"] in core/unfold.py. */
    --fe-primary: oklch(0.4500 0.1900 23.62);
    --fe-primary-hover: oklch(0.3700 0.1700 23.62);
    --fe-primary-soft: oklch(0.9700 0.0150 23.62);
    --fe-primary-border: oklch(0.7900 0.1300 23.62);
    --fe-primary-ring: oklch(0.5452 0.2143 23.62 / 0.18);
    --fe-header-bg: #ffffff;
    --fe-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    --fe-radius: 12px;
    --fe-container-width: 960px;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--fe-bg);
    color: var(--fe-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Shared centered column for header, messages and page content. */
.site-container {
    width: 100%;
    max-width: var(--fe-container-width);
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .site-container {
        padding: 0 24px;
    }
}

.site-header {
    background: var(--fe-header-bg);
    border-bottom: 1px solid var(--fe-border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.site-header__brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-header__logo {
    height: 32px;
    width: auto;
    display: block;
}

.site-header__nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.site-header__link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--fe-text-muted);
    text-decoration: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.site-header__link:hover {
    background: var(--fe-primary-soft);
    color: var(--fe-primary);
}

.site-main {
    flex: 1;
    padding: 24px 0;
}

.site-card {
    background: var(--fe-surface);
    border-radius: var(--fe-radius);
    padding: 40px 32px;
    border: 1px solid var(--fe-border);
    text-align: center;
}

.site-card h1 {
    margin: 10px 0 12px;
    font-size: 28px;
    line-height: 1.2;
    color: #0f172a;
}

.site-card p {
    margin: 0;
    color: var(--fe-text-muted);
    font-size: 17px;
}

.site-card .logo {
    width: min(100%, 420px);
    height: auto;
    margin: 0 auto 12px;
    display: block;
}

.btn {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--fe-primary);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    transition: background-color 0.2s ease;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Auth modal */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.auth-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 24rem;
    border-radius: var(--fe-radius);
    border: 1px solid var(--fe-border);
    background-color: var(--fe-surface);
    padding: 1.5rem;
    box-shadow: var(--fe-shadow);
}

.auth-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: #64748b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.auth-modal__close:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.auth-modal__title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.auth-modal__field {
    margin-bottom: 0.875rem;
    text-align: left;
}

.auth-modal__field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

.auth-modal__field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
}

.auth-modal__field input:focus {
    outline: none;
    border-color: var(--fe-primary);
    box-shadow: 0 0 0 3px var(--fe-primary-ring);
}

.auth-modal__error {
    margin: 0 0 0.875rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.875rem;
    text-align: left;
}

.auth-modal__error[hidden] {
    display: none;
}

.auth-modal__submit {
    width: 100%;
    margin-top: 0.25rem;
}

.messages {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.messages li {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.messages .error {
    background: #fef2f2;
    color: #b91c1c;
}

.messages .success {
    background: #f0fdf4;
    color: #15803d;
}
