body.legal-page {
    --brand-primary: #12355b;
    --brand-primary-hover: #0d2948;
    --brand-secondary: #3e78a8;
    --brand-accent: #6fafc4;
    --surface: #ffffff;
    --surface-soft: #f7f9fb;
    --border: #d8e0e7;
    --text-primary: #172b3a;
    --text-secondary: #5e6d79;
    min-width: 320px;
    margin: 0;
    color: var(--text-primary);
    background: #eef4f8;
    font-family: var(--font-family-sans, Inter, Arial, sans-serif);
}

body.legal-page *,
body.legal-page *::before,
body.legal-page *::after {
    box-sizing: border-box;
}

.legal-container {
    width: min(100% - 40px, 1180px);
    margin-inline: auto;
}

.legal-header {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
}

.legal-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
}

.legal-brand,
.legal-nav,
.auth-actions-row {
    display: flex;
    align-items: center;
}

.legal-brand {
    gap: 12px;
    color: var(--brand-primary);
    font-size: 1.28rem;
    font-weight: 800;
    text-decoration: none;
}

.legal-brand img {
    display: block;
    object-fit: contain;
    border-radius: 8px;
}

.legal-nav,
.auth-actions-row {
    gap: 14px;
}

.auth-actions-row .auth-link {
    margin-top: 0;
}

.legal-nav a,
.auth-actions-row a {
    color: var(--brand-primary, var(--auth-navy, #12355b));
    font-weight: 750;
    text-decoration: none;
}

.legal-nav a:hover,
.auth-actions-row a:hover {
    color: var(--brand-secondary);
}

.legal-document {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;
    padding: 30px 0 44px;
}

.legal-toc {
    position: sticky;
    top: 20px;
    display: grid;
    align-self: start;
    gap: 7px;
    max-height: calc(100vh - 40px);
    padding: 16px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 26px rgba(18, 53, 91, 0.06);
}

.legal-toc strong {
    margin-bottom: 4px;
    color: var(--brand-primary);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.legal-toc a {
    color: #263d55;
    font-size: 0.9rem;
    line-height: 1.25;
    text-decoration: none;
}

.legal-toc a:hover {
    color: var(--brand-secondary);
}

.terms-article {
    min-width: 0;
    padding: clamp(22px, 4vw, 42px);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 16px 36px rgba(18, 53, 91, 0.08);
}

.legal-kicker {
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.terms-article h1 {
    margin: 0;
    color: var(--brand-primary);
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.05;
}

.legal-subtitle {
    margin: 8px 0 0;
    color: #20324c;
    font-size: 1.18rem;
    font-weight: 750;
}

.legal-meta {
    display: grid;
    gap: 8px;
    margin: 24px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfe;
}

.legal-meta div {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
}

.legal-meta dt {
    color: var(--text-secondary);
    font-weight: 800;
}

.legal-meta dd {
    margin: 0;
}

.terms-article section {
    scroll-margin-top: 20px;
    margin-top: 28px;
}

.terms-article h2 {
    margin: 0 0 10px;
    color: var(--brand-primary);
    font-size: 1.32rem;
    line-height: 1.25;
}

.terms-article p,
.terms-article li {
    color: #263744;
    font-size: 1rem;
    line-height: 1.68;
}

.terms-article a {
    color: var(--brand-primary);
    font-weight: 750;
}

.terms-article p {
    margin: 10px 0;
}

.terms-article ul {
    margin: 10px 0 0;
    padding-left: 22px;
}

.terms-highlight {
    padding: 16px 18px;
    border-left: 4px solid var(--brand-accent);
    border-radius: 8px;
    background: #f5f8fb;
}

.terms-essential {
    margin-top: 24px;
}

.legal-note {
    padding: 14px 16px;
    border: 1px solid rgba(111, 175, 196, 0.36);
    border-radius: 8px;
    background: #fbfcfe;
}

.legal-note p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.94rem;
}

.auth-card--terms {
    width: min(100%, 720px);
    justify-self: center;
}

.terms-summary {
    padding: 14px 16px;
    border: 1px solid var(--auth-line, #d6e1eb);
    border-left: 4px solid var(--auth-cyan, #20a6b8);
    border-radius: 8px;
    background: #f7fbfd;
}

.terms-summary ul {
    margin: 0;
    padding-left: 20px;
}

.terms-summary li {
    color: #263744;
    line-height: 1.48;
}

.terms-acceptance-form {
    margin-top: 20px;
}

.auth-checkbox {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--auth-line, #d6e1eb);
    border-radius: 8px;
    background: #fbfcfe;
}

.auth-checkbox input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.auth-checkbox span {
    color: #20324c;
    font-size: 0.94rem;
    line-height: 1.42;
}

.auth-form button:disabled {
    border-color: #9cadba;
    background: #9cadba;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.contact-list {
    display: grid;
    gap: 12px;
}

.contact-list article {
    padding: 14px;
    border: 1px solid var(--auth-line, #d6e1eb);
    border-radius: 8px;
    background: #fbfcfe;
}

.contact-list h2 {
    margin: 0 0 6px;
    color: var(--auth-navy, #12355b);
    font-size: 1rem;
}

.contact-list a {
    color: var(--auth-blue, #1f78a8);
    font-weight: 750;
}

@media (max-width: 880px) {
    .legal-document {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;
        max-height: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legal-toc strong {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .legal-container {
        width: min(100% - 24px, 1180px);
    }

    .legal-header__inner,
    .legal-nav,
    .auth-actions-row {
        align-items: stretch;
        flex-direction: column;
    }

    .legal-header__inner {
        padding: 14px 0;
    }

    .legal-nav {
        gap: 8px;
    }

    .legal-toc {
        grid-template-columns: 1fr;
    }

    .legal-meta div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
