:root {
    --bg: #f6f7f9;
    --paper: #ffffff;
    --ink: #1a2332;
    --muted: #5c6778;
    --line: #d8dee8;
    --accent: #1f5f8b;
    --accent-dark: #174e75;
    --accent-soft: #e8f2fa;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(26, 35, 50, 0.06);
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 248px;
    --article-rail-width: 260px;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: linear-gradient(180deg, #eef3f8 0%, var(--bg) 240px, var(--bg) 100%);
    line-height: 1.65;
}

.hb-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hb-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(246, 247, 249, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.hb-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-height);
    padding: 0.5rem 1.25rem;
}

.hb-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
}

.hb-brand:hover {
    color: var(--accent);
}

.hb-brand img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.hb-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.hb-brand-text {
    font-size: 1.05rem;
    line-height: 1.2;
}

.hb-brand-claim {
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.hb-brand:hover .hb-brand-claim {
    color: var(--accent);
}

.hb-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin-left: auto;
}

.hb-whitepaper-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.8rem;
    padding: 0.15rem 0;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.hb-whitepaper-link:hover,
.hb-whitepaper-link:focus-visible {
    color: var(--accent);
    text-decoration: none;
    outline: none;
}

.hb-whitepaper-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.hb-pdf-glyph {
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.95rem;
    border: 1.5px solid currentColor;
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.hb-pdf-glyph::after {
    content: "";
    position: absolute;
    top: -1.5px;
    right: -1.5px;
    width: 0.42rem;
    height: 0.42rem;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    border-radius: 0 4px 0 2px;
    background: color-mix(in srgb, var(--paper) 82%, var(--bg));
}

.hb-whitepaper-link:hover .hb-pdf-glyph,
.hb-whitepaper-link:focus-visible .hb-pdf-glyph {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

@media (max-width: 720px) {
    .hb-brand-text {
        font-size: 0.82rem;
    }

    .hb-brand-claim {
        font-size: 0.58rem;
        letter-spacing: 0.04em;
    }

    .hb-whitepaper-link {
        font-size: 0.78rem;
    }
}

@media (max-width: 520px) {
    .hb-brand-claim {
        display: none;
    }

    .hb-whitepaper-link {
        max-width: 7rem;
        white-space: normal;
        text-align: center;
    }
}

.hb-body {
    display: flex;
    flex: 1;
    align-items: flex-start;
    width: 100%;
}

.hb-sidebar {
    flex: 0 0 var(--sidebar-width);
    position: sticky;
    top: var(--header-height);
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1rem 0.75rem 1.75rem;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.5);
}

.hb-sidebar-welcome {
    display: block;
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.75rem;
    border: 1px solid rgba(31, 95, 139, 0.28);
    border-radius: 10px;
    background: var(--paper);
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(31, 95, 139, 0.18);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hb-sidebar-welcome:hover,
.hb-sidebar-welcome.is-current {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.hb-sidebar-welcome:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hb-sidebar-title {
    margin: 0 0 0.35rem;
    padding: 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.hb-topic-group-nav {
    margin: 0 0 0.85rem;
    padding: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 8px 20px rgba(26, 35, 50, 0.04);
}

.hb-topic-group-nav.is-current {
    border-color: rgba(31, 95, 139, 0.35);
}

.hb-category-branch {
    display: block;
}

.hb-topic-group-nav > .hb-sidebar-title {
    margin: 0 0 0.45rem;
    padding: 0.52rem 0.65rem;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    letter-spacing: 0.07em;
}

.hb-category-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.hb-category-summary::-webkit-details-marker {
    display: none;
}

.hb-category-summary::marker {
    content: "";
}

.hb-category-summary::after {
    content: "›";
    flex: 0 0 auto;
    font-size: 1rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.15s ease;
}

.hb-category-branch[open] > .hb-category-summary::after {
    transform: rotate(90deg);
}

.hb-category-summary:hover,
.hb-category-summary:focus-visible {
    background: var(--accent-dark);
}

.hb-category-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hb-topic-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.hb-topic-list a {
    display: block;
    padding: 0.34rem 0.65rem;
    margin: 0 0.35rem 0 0;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink);
    font-size: 0.9rem;
    line-height: 1.3;
}

.hb-topic-group-nav .hb-topic-list a {
    margin-right: 0;
}

.hb-topic-list a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.hb-topic-list a.is-current {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.hb-topic-list a[data-topic-id="mein-ephraim"] {
    font-weight: 600;
}

.hb-topic-group-nav[data-category-id="rechtliches"] .hb-topic-list a {
    font-weight: 600;
}

.hb-topic-branch {
    margin: 0 0.35rem 0 0;
}

.hb-topic-group-nav .hb-topic-branch {
    margin-right: 0;
}

.hb-topic-branch-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.34rem 0.65rem;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    list-style: none;
    line-height: 1.3;
    user-select: none;
}

.hb-topic-branch-summary::-webkit-details-marker {
    display: none;
}

.hb-topic-branch-summary::marker {
    content: "";
}

.hb-topic-branch-summary::after {
    content: "›";
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.15s ease, color 0.15s ease;
}

.hb-topic-branch[open] .hb-topic-branch-summary::after {
    transform: rotate(90deg);
}

.hb-topic-branch-summary:hover,
.hb-topic-branch-summary.is-current-parent {
    background: var(--accent-soft);
    color: var(--accent);
}

.hb-topic-branch-summary:hover::after,
.hb-topic-branch-summary.is-current-parent::after {
    color: var(--accent);
}

.hb-topic-branch-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hb-topic-sublist {
    list-style: none;
    margin: 0.15rem 0 0.2rem 0.55rem;
    padding: 0 0 0 0.55rem;
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.02rem;
}

.hb-topic-sublist a {
    padding: 0.3rem 0.55rem;
    margin: 0;
    font-size: 0.85rem;
}

.hb-topic-group-nav + .hb-topic-group-nav {
    margin-top: 0;
}

.hb-sidebar-glossary {
    display: block;
    margin: 0.1rem 0 0.35rem;
    padding: 0.7rem 0.75rem;
    border: 1px solid rgba(31, 95, 139, 0.28);
    border-radius: 10px;
    background: var(--paper);
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(26, 35, 50, 0.04);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hb-sidebar-glossary:hover,
.hb-sidebar-glossary.is-current {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.hb-sidebar-glossary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hb-sidebar-footer {
    display: block;
    margin-top: auto;
    padding: 0.45rem 0.65rem 0;
    color: color-mix(in srgb, var(--muted) 72%, transparent);
    font-size: 0.68rem;
    line-height: 1.35;
}

.hb-sidebar-footer span {
    display: block;
}

.hb-sidebar-legal-links {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    margin: 0 0 0.85rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
}

.hb-sidebar-footer .hb-sidebar-legal-links {
    display: flex;
}

.hb-sidebar-legal-links a {
    display: inline-block;
    width: fit-content;
    padding: 0.08rem 0.2rem;
    margin-left: -0.2rem;
    border-radius: 5px;
    color: var(--accent);
    font-size: 0.72rem;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.hb-sidebar-legal-links a:hover,
.hb-sidebar-legal-links a:focus-visible,
.hb-sidebar-legal-links a.is-current {
    background: var(--accent-soft);
    color: var(--accent-dark);
    text-decoration: none;
}

.hb-sidebar-legal-links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.hb-sidebar-team {
    margin-top: 0.25rem;
    color: color-mix(in srgb, var(--muted) 62%, transparent);
}

.hb-sidebar-updated {
    font-size: 0.62rem;
    font-style: italic;
    margin-top: 0.45rem;
}

.hb-article-nav {
    margin-top: 1.35rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--line);
}

.hb-article-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hb-article-nav-list a {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.4rem 0.55rem 0.4rem 0.75rem;
    margin-right: 0.35rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
    border-left: 2px solid transparent;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.hb-article-nav-list a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: rgba(31, 95, 139, 0.35);
}

.hb-article-nav-list a.is-active {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-soft);
    border-left-color: var(--accent);
}

.hb-article-nav-num {
    flex: 0 0 auto;
    min-width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--ink);
    margin-top: 0.05rem;
}

.hb-article-nav-list a.is-active .hb-article-nav-num {
    background: var(--accent);
    color: #fff;
}

.hb-article-nav-label {
    flex: 1;
    min-width: 0;
}

.hb-article-rail {
    display: none;
    flex: 0 0 var(--article-rail-width);
    position: sticky;
    top: var(--header-height);
    align-self: flex-start;
    min-height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1rem 0.75rem 1.75rem;
    border-left: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.45);
}

.hb-article-rail .hb-article-nav {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.hb-article-rail .hb-article-nav-list {
    padding-right: 0;
}

.hb-article-rail .hb-article-nav-list a {
    margin-right: 0;
}

.hb-main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: none;
    padding: 2rem 1.25rem 4rem;
}

@media (min-width: 1280px) {
    :root {
        --sidebar-width: 284px;
    }

    .hb-article-rail {
        display: block;
    }

    .hb-article-rail[hidden] {
        display: none;
    }
}

@media (max-width: 768px) {
    .hb-body {
        flex-direction: column;
    }

    .hb-sidebar {
        position: static;
        flex: none;
        width: 100%;
        min-height: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 0.75rem 1rem 1rem;
    }

    .hb-topic-list,
    .hb-topic-group-nav .hb-topic-list {
        display: flex;
        flex-direction: column;
        gap: 0.08rem;
    }

    .hb-topic-list > li {
        width: 100%;
    }

    .hb-topic-branch {
        margin-right: 0;
    }

    .hb-topic-sublist {
        margin-left: 0.55rem;
    }

    .hb-topic-group-nav {
        margin-top: 0.55rem;
        padding-top: 0.55rem;
    }

    .hb-article-nav {
        display: none;
    }

    .hb-article-rail {
        display: none;
    }
}

section[id] {
    scroll-margin-top: calc(var(--header-height) + 0.75rem);
}
