:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #edf3fb;
    --text: #14213d;
    --muted: #61708a;
    --line: #dce4ef;
    --brand: #173b78;
    --brand-2: #315fa8;
    --accent: #f28c00;
    --accent-soft: #fff4e4;
    --success: #1b8a5a;
    --shadow: 0 16px 45px rgba(21, 48, 89, .11);
    --shadow-soft: 0 8px 24px rgba(21, 48, 89, .08);
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --header-height: 78px;
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #09111f;
    --surface: #101b2d;
    --surface-soft: #132138;
    --surface-strong: #192b47;
    --text: #edf4ff;
    --muted: #a9b8ce;
    --line: #29405f;
    --brand: #79a7ff;
    --brand-2: #aac6ff;
    --accent: #ffac3f;
    --accent-soft: #332613;
    --success: #58d69b;
    --shadow: 0 18px 48px rgba(0, 0, 0, .35);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, .24);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 22px); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 5% 0%, rgba(49, 95, 168, .13), transparent 32%),
        radial-gradient(circle at 95% 10%, rgba(242, 140, 0, .11), transparent 28%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
a { color: var(--brand-2); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1200;
    background: transparent;
}
.reading-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-2), var(--accent));
    transition: width .08s linear;
}

.saas-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--header-height);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.saas-header__inner {
    width: min(1480px, calc(100% - 32px));
    min-height: var(--header-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}
.institution-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
}
.institution-brand__wide {
    display: block;
    width: min(470px, 38vw);
    height: 56px;
    object-fit: contain;
    object-position: left center;
}
.institution-brand__round { display: none; width: 48px; height: 48px; object-fit: contain; }
.desktop-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.desktop-nav a {
    padding: 10px 13px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.desktop-nav a:hover, .desktop-nav a.is-active {
    color: var(--brand);
    background: var(--surface-strong);
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    box-shadow: var(--shadow-soft);
}
.icon-button:hover { transform: translateY(-1px); border-color: var(--brand-2); }
.mobile-menu-button { display: none; }

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary {
    color: #fff;
    background: linear-gradient(135deg, #173b78, #315fa8);
    box-shadow: 0 10px 24px rgba(23, 59, 120, .2);
}
.button--secondary {
    color: var(--text);
    border-color: var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.legal-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 28px auto 56px;
    display: grid;
    grid-template-columns: 294px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.desktop-toc { position: sticky; top: calc(var(--header-height) + 24px); }
.toc-card {
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-soft);
}
.toc-eyebrow, .hero-kicker {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.toc-card h2 { margin: 0; color: var(--text); font-size: 19px; line-height: 1.28; }
.toc-updated { margin: 7px 0 15px; color: var(--muted); font-size: 12px; }
.toc-card nav { display: grid; gap: 4px; }
.toc-card nav a {
    display: block;
    padding: 8px 10px;
    border-left: 3px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 680;
    line-height: 1.35;
    text-decoration: none;
}
.toc-card nav a:hover, .toc-card nav a.is-active {
    color: var(--brand);
    border-left-color: var(--accent);
    background: var(--surface-strong);
}
.toc-support {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 2px;
    font-size: 12px;
}
.toc-support span { color: var(--muted); }
.toc-support a { font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }

.legal-main { min-width: 0; }
.legal-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: clamp(24px, 4vw, 46px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    color: var(--text);
    background:
        linear-gradient(120deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface) 82%, transparent)),
        radial-gradient(circle at 100% 0%, rgba(242, 140, 0, .22), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(49, 95, 168, .2), transparent 48%);
    box-shadow: var(--shadow);
}
.legal-hero h1 {
    margin: 0;
    max-width: 850px;
    font-size: clamp(32px, 5vw, 60px);
    line-height: 1.04;
    letter-spacing: -.045em;
}
.hero-description { max-width: 820px; margin: 18px 0 0; color: var(--muted); font-size: clamp(15px, 1.7vw, 18px); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface);
    font-size: 12px;
    font-weight: 800;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 16%, transparent); }
.hero-actions { display: flex; flex-direction: column; flex: 0 0 165px; gap: 9px; }

.notice-card {
    margin: 18px 0;
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
    box-shadow: var(--shadow-soft);
}
.notice-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--accent);
    font-weight: 900;
}
.notice-card strong { color: var(--text); }
.notice-card p { margin: 4px 0 0; color: var(--muted); }

.legal-document {
    padding: clamp(24px, 4vw, 52px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.legal-section {
    position: relative;
    padding: 31px 0;
    border-bottom: 1px solid var(--line);
}
.legal-section:first-child { padding-top: 0; }
.legal-section:last-child { padding-bottom: 0; border-bottom: 0; }
.section-heading {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-bottom: 15px;
}
.section-number {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(23, 59, 120, .2);
}
.legal-section h2 { margin: 0; color: var(--text); font-size: clamp(21px, 2.3vw, 28px); line-height: 1.2; letter-spacing: -.02em; }
.legal-section h3 { margin: 22px 0 8px; color: var(--text); font-size: 17px; }
.legal-section p { margin: 10px 0; color: var(--muted); text-align: left; }
.legal-section ul, .legal-section ol { margin: 12px 0 12px 22px; padding: 0; color: var(--muted); }
.legal-section li { margin: 8px 0; padding-left: 4px; }
.legal-section strong { color: var(--text); }
.legal-section a { font-weight: 750; }
.inline-code {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    background: var(--surface-soft);
    font: 600 .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}
.data-table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; background: var(--surface); }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--text); background: var(--surface-strong); font-size: 13px; }
.data-table td { color: var(--muted); font-size: 14px; }
.data-table tr:last-child td { border-bottom: 0; }
.callout {
    margin: 18px 0;
    padding: 15px 17px;
    border-left: 4px solid var(--brand-2);
    border-radius: 0 12px 12px 0;
    background: var(--surface-strong);
}
.callout p { margin: 0; }

.legal-contact-card {
    margin-top: 18px;
    padding: clamp(22px, 4vw, 34px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.legal-contact-card h2 { margin: 0; font-size: 24px; }
.legal-contact-card p:not(.hero-kicker) { margin: 8px 0 0; color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.legal-footer {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 25px 0 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    font-size: 13px;
}
.legal-footer > div { display: grid; }
.legal-footer strong { color: var(--text); }
.legal-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.legal-footer a { color: var(--muted); font-weight: 750; text-decoration: none; }
.legal-footer a:hover { color: var(--brand); }

.mobile-toc, .mobile-toc-backdrop { display: none; }
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 1400;
    transform: translate(-50%, 24px);
    opacity: 0;
    pointer-events: none;
    padding: 11px 15px;
    border-radius: 12px;
    color: #fff;
    background: #12213a;
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
    font-size: 13px;
    font-weight: 750;
    transition: .2s ease;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1040px) {
    .legal-shell { grid-template-columns: 250px minmax(0, 1fr); gap: 20px; }
    .institution-brand__wide { width: min(390px, 38vw); }
    .legal-hero { align-items: stretch; flex-direction: column; }
    .hero-actions { flex: initial; flex-direction: row; }
}

@media (max-width: 820px) {
    :root { --header-height: 66px; }
    .saas-header__inner { width: min(100% - 20px, 1480px); gap: 10px; }
    .institution-brand__wide { display: none; }
    .institution-brand__round { display: block; width: 46px; height: 46px; }
    .desktop-nav, .desktop-login { display: none; }
    .header-actions { margin-left: auto; }
    .mobile-menu-button { display: inline-grid; }
    .legal-shell { display: block; width: min(100% - 20px, 1480px); margin-top: 16px; }
    .desktop-toc { display: none; }
    .legal-hero { padding: 25px 21px; border-radius: 20px; }
    .hero-actions { width: 100%; }
    .hero-actions .button { flex: 1; }
    .notice-card { border-radius: 16px; }
    .legal-document { padding: 26px 20px; border-radius: 20px; }
    .section-heading { grid-template-columns: 36px minmax(0,1fr); gap: 11px; }
    .section-number { width: 36px; height: 36px; border-radius: 11px; }
    .legal-contact-card { align-items: flex-start; flex-direction: column; border-radius: 20px; }
    .contact-actions { width: 100%; justify-content: stretch; }
    .contact-actions .button { flex: 1 1 170px; }
    .legal-footer { align-items: flex-start; flex-direction: column; }

    .mobile-toc-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1180;
        background: rgba(3, 10, 23, .56);
        opacity: 0;
        transition: opacity .22s ease;
    }
    .mobile-toc-backdrop.is-open { opacity: 1; }
    .mobile-toc {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        width: min(88vw, 370px);
        padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
        flex-direction: column;
        background: var(--surface);
        box-shadow: -20px 0 50px rgba(0,0,0,.25);
        transform: translateX(105%);
        transition: transform .24s ease;
    }
    .mobile-toc.is-open { transform: translateX(0); }
    .mobile-toc__header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
    .mobile-toc nav { flex: 1; overflow: auto; padding: 10px 0; display: grid; align-content: start; gap: 4px; }
    .mobile-toc nav a { padding: 11px 10px; border-radius: 10px; color: var(--muted); font-weight: 720; text-decoration: none; }
    .mobile-toc nav a:hover, .mobile-toc nav a.is-active { color: var(--brand); background: var(--surface-strong); }
    .mobile-login { width: 100%; margin-top: 10px; }
}

@media (max-width: 520px) {
    .legal-shell, .legal-footer { width: min(100% - 14px, 1480px); }
    .legal-hero h1 { font-size: 35px; }
    .hero-actions { flex-direction: column; }
    .notice-card { padding: 15px; }
    .notice-icon { flex-basis: 34px; width: 34px; height: 34px; }
    .legal-document { padding: 23px 17px; }
    .legal-section { padding: 27px 0; }
    .legal-section ul, .legal-section ol { margin-left: 18px; }
    .data-table-wrap { margin-left: -5px; margin-right: -5px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@page { size: A4; margin: 14mm; }
@media print {
    :root, html[data-theme="dark"] {
        --bg: #fff;
        --surface: #fff;
        --surface-soft: #fff;
        --surface-strong: #f5f5f5;
        --text: #000;
        --muted: #222;
        --line: #b8b8b8;
        --brand: #173b78;
        --brand-2: #173b78;
        --accent: #f28c00;
    }
    body { background: #fff !important; font-family: Georgia, "Times New Roman", serif; font-size: 11pt; }
    .reading-progress, .saas-header, .desktop-toc, .mobile-toc, .mobile-toc-backdrop, .hero-actions, .legal-contact-card, .legal-footer, .toast { display: none !important; }
    .legal-shell { width: auto; margin: 0; display: block; }
    .legal-hero { padding: 0 0 10mm; border: 0; border-radius: 0; box-shadow: none; background: #fff; break-after: avoid; }
    .legal-hero h1 { font-size: 26pt; }
    .hero-description { color: #222; font-size: 11pt; }
    .notice-card { margin: 0 0 7mm; padding: 4mm; border-radius: 0; box-shadow: none; break-inside: avoid; }
    .legal-document { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
    .legal-section { padding: 6mm 0; break-inside: auto; }
    .section-heading { break-after: avoid; }
    .section-number { color: #000; border: 1px solid #000; background: #fff; box-shadow: none; }
    .legal-section h2 { font-size: 16pt; }
    .legal-section h3 { font-size: 12.5pt; break-after: avoid; }
    .legal-section p, .legal-section li { color: #111; text-align: justify; }
    a { color: #000; text-decoration: none; }
    .data-table-wrap { overflow: visible; border-radius: 0; }
    .data-table { min-width: 0; font-size: 9.5pt; }
    .data-table th, .data-table td { padding: 2.5mm; }
}
