:root {
    color-scheme: light;
    --ink: #17213a;
    --muted: #5f6b7f;
    --line: #dfe5ef;
    --paper: #ffffff;
    --wash: #f4f7fb;
    --brand: #5b3df5;
    --brand-dark: #3f2ac3;
    --brand-soft: #eeebff;
    --good: #087f5b;
    --good-soft: #e8f8f1;
    --warn: #9a5b00;
    --warn-soft: #fff5db;
    --danger: #ad2d2d;
    --danger-soft: #fff0f0;
    --code: #10172a;
    --shadow: 0 16px 44px rgba(33, 43, 67, 0.1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--wash);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.68;
}

a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 0.55rem;
    background: var(--ink);
    color: #fff;
    transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.layout {
    display: grid;
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    border-right: 1px solid var(--line);
    background: #fff;
    padding: 1.5rem 1.15rem 2rem;
}

.brand {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.brand-mark {
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    place-items: center;
    border-radius: 0.8rem;
    background: linear-gradient(145deg, var(--brand), #8b78ff);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(91, 61, 245, 0.28);
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 0.75rem; }

.search-wrap { position: relative; }
.search-wrap label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.search-wrap input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: var(--wash);
    padding: 0.72rem 2.3rem 0.72rem 0.78rem;
    color: var(--ink);
    font: inherit;
}
.search-wrap input:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.shortcut { position: absolute; right: 0.65rem; bottom: 0.8rem; color: var(--muted); font-size: 0.72rem; }
.search-status { min-height: 1.5rem; margin: 0.35rem 0 0.8rem; color: var(--muted); font-size: 0.78rem; }

.nav-group { margin-top: 1.2rem; }
.nav-group > strong { display: block; margin: 0 0 0.4rem 0.65rem; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-group a {
    display: block;
    padding: 0.42rem 0.65rem;
    border-radius: 0.48rem;
    color: #46536a;
    font-size: 0.86rem;
    text-decoration: none;
}
.nav-group a:hover, .nav-group a[aria-current="location"] { background: var(--brand-soft); color: var(--brand-dark); }

.content { min-width: 0; padding: 2.4rem clamp(1.25rem, 5vw, 5rem) 5rem; }
.content-inner { width: min(980px, 100%); margin: 0 auto; }

.hero {
    overflow: hidden;
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 1.2rem;
    padding: clamp(2rem, 7vw, 4.5rem);
    background: linear-gradient(135deg, #20165f 0%, #4c32d0 58%, #745dff 100%);
    color: #fff;
    box-shadow: var(--shadow);
}
.hero::after {
    content: "";
    position: absolute;
    right: -8rem;
    bottom: -11rem;
    width: 26rem;
    height: 26rem;
    border: 1px solid rgba(255,255,255,.17);
    border-radius: 50%;
    box-shadow: 0 0 0 4rem rgba(255,255,255,.035), 0 0 0 8rem rgba(255,255,255,.025);
}
.hero > * { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 0.35rem; color: #d9d2ff; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 4.3rem); line-height: 1.05; letter-spacing: -0.045em; }
.hero .lead { max-width: 700px; margin: 1.1rem 0 1.5rem; color: #eeeaff; font-size: 1.08rem; }
.pills { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.pill { border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.11); padding: 0.35rem 0.72rem; font-size: 0.78rem; }

.notice {
    margin: 1.15rem 0;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 0.8rem;
    background: #fff;
    padding: 0.9rem 1rem;
}
.notice strong { display: block; margin-bottom: 0.15rem; }
.notice p:last-child { margin-bottom: 0; }
.notice.good { border-left-color: var(--good); background: var(--good-soft); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); }

.doc-section {
    scroll-margin-top: 1rem;
    margin: 1.25rem 0;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--paper);
    padding: clamp(1.2rem, 4vw, 2.15rem);
    box-shadow: 0 5px 18px rgba(35, 48, 75, 0.045);
}
.doc-section[hidden] { display: none; }
.section-number { display: inline-block; margin-bottom: 0.35rem; color: var(--brand); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.doc-section h2 { margin: 0 0 0.8rem; font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -0.025em; }
.doc-section h3 { margin: 1.55rem 0 0.45rem; font-size: 1.05rem; }
.doc-section p, .doc-section ul, .doc-section ol { margin-top: 0.55rem; margin-bottom: 0.8rem; }
.doc-section li + li { margin-top: 0.35rem; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin: 1rem 0; }
.card { border: 1px solid var(--line); border-radius: 0.75rem; background: var(--wash); padding: 0.9rem; }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.91rem; }
th, td { border: 1px solid var(--line); padding: 0.68rem 0.72rem; text-align: left; vertical-align: top; }
th { background: var(--wash); font-size: 0.78rem; letter-spacing: 0.03em; text-transform: uppercase; }

code { border-radius: 0.25rem; background: #eef1f7; padding: 0.08rem 0.3rem; color: #313e5c; font: 0.88em ui-monospace, SFMono-Regular, Consolas, monospace; }
pre { overflow: auto; margin: 0.85rem 0; border-radius: 0.75rem; background: var(--code); padding: 1rem; color: #e6eafe; line-height: 1.55; }
pre code { background: transparent; padding: 0; color: inherit; }
.copy-hint { color: var(--muted); font-size: 0.78rem; }

.checklist { padding-left: 0; list-style: none; }
.checklist li { position: relative; padding-left: 1.55rem; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 900; }

.no-results { display: none; border: 1px dashed var(--line); border-radius: 1rem; background: #fff; padding: 2rem; text-align: center; }
.no-results.visible { display: block; }
mark.search-hit { border-radius: 0.15rem; background: #ffe89a; padding: 0 .05rem; }

.footer { padding: 2rem 0 0; color: var(--muted); font-size: 0.84rem; text-align: center; }
.print-only { display: none; }

@media (max-width: 860px) {
    .layout { display: block; }
    .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .nav-group { display: none; }
    .content { padding-top: 1.25rem; }
    .grid { grid-template-columns: 1fr; }
}

@media print {
    body { background: #fff; color: #111; font-size: 10.5pt; }
    .layout { display: block; }
    .sidebar, .skip-link, .no-print { display: none !important; }
    .content { padding: 0; }
    .content-inner { width: 100%; }
    .hero { background: #fff; color: #111; box-shadow: none; border: 1px solid #bbb; }
    .hero .lead, .eyebrow { color: #333; }
    .pill { border-color: #aaa; background: #fff; }
    .doc-section { break-inside: avoid; box-shadow: none; }
    .doc-section[hidden] { display: block; }
    a { color: #111; text-decoration: none; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; word-break: break-all; }
    .print-only { display: block; }
}

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