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

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: #1f2937;
    background: #f3f4f6;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px max(24px, calc((100% - 1120px) / 2));
    background: #fff;
}

.site-header {
    border-bottom: 1px solid #e5e7eb;
}

.admin-header {
    border-bottom: 3px solid #991b1b;
}

.user-header {
    border-bottom: 3px solid #dc2626;
}

.brand {
    color: #b91c1c;
    font-weight: 800;
    letter-spacing: .04em;
    text-decoration: none;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 20px;
    color: #dc2626;
    font-size: 1.65rem;
    font-weight: 800;
}

.login-brand a {
    color: inherit;
    font-size: 2rem;
    line-height: 1;
    text-decoration: none;
}

.login-brand a:focus-visible {
    border-radius: 6px;
    outline: 3px solid #dc2626;
    outline-offset: 4px;
}

.brand span {
    margin-inline-start: 8px;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.site-header nav a,
.site-footer a {
    color: #475569;
    text-decoration: none;
}

.site-header nav a:hover,
.site-footer a:hover {
    color: #b91c1c;
}

.page-content {
    width: min(100% - 32px, 680px);
    margin: auto;
    padding: 40px 0;
}

.auth-card {
    padding: clamp(24px, 5vw, 40px);
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 48px #0f172a12;
}

h1 {
    margin: 0 0 20px;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

h2 {
    margin: 0 0 12px;
    font-size: 1.15rem;
}

section {
    padding: 18px 0;
    border-top: 1px solid #e5e7eb;
}

label {
    display: block;
    margin: 12px 0 6px;
    font-weight: 600;
}

input:not([type="checkbox"]) {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}

button {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border: 0;
    border-radius: 8px;
    background: #dc2626;
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.admin-layout button {
    background: #991b1b;
}

.secondary {
    background: #334155 !important;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
}

.check input {
    margin-top: 5px;
}

.muted {
    color: #64748b;
}

.message {
    margin: 12px 0;
    padding: 12px;
    border-radius: 8px;
}

.error {
    background: #fef2f2;
    color: #991b1b;
}

.notice {
    background: #eff6ff;
    color: #1e40af;
}

.resend {
    margin-top: 8px;
}

.link-button {
    margin-top: 4px;
    background: transparent !important;
    color: #b91c1c;
}

.back {
    display: inline-block;
    font-size: .95rem;
}

.auth-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.view-switch {
    margin: 0;
}

.view-switch .link-button {
    width: auto;
    padding: 4px 0;
}

.auth-navigation > a,
.auth-navigation .view-switch .link-button {
    margin: 0;
    padding: 4px 0;
    background: transparent !important;
    color: #b91c1c;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: .15em;
}

.auth-navigation > a:hover,
.auth-navigation .view-switch .link-button:hover {
    color: #991b1b;
}

.auth-navigation > a:focus-visible,
.auth-navigation .view-switch .link-button:focus-visible {
    border-radius: 3px;
    outline: 2px solid #b91c1c;
    outline-offset: 3px;
}

.site-footer {
    color: #64748b;
    font-size: .875rem;
}

.admin-footer {
    border-top: 1px solid #fecaca;
}

.user-footer {
    border-top: 1px solid #e5e7eb;
}

[dir="rtl"] .site-header nav {
    direction: rtl;
}

@media (max-width: 600px) {
    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 18px;
    }

    .site-header nav {
        gap: 12px;
        font-size: .9rem;
    }

    .page-content {
        width: min(100% - 24px, 680px);
        padding: 24px 0;
    }
}
