html {
    color-scheme: light;
}

html.dark,
html.dark-mode {
    color-scheme: dark;
}

body.help-page {
    --help-sticky-top: 24px;
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--lc-bg, #f4f7fb);
    color: var(--lc-text-secondary, #334155);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.help-page-authenticated {
    --help-sticky-top: 96px;
}

.help-page *:focus-visible {
    outline: 2px solid var(--lc-primary, #2563eb);
    outline-offset: 3px;
}

.help-page *:focus:not(:focus-visible) {
    outline: none;
}

.help-page ::selection {
    background: var(--lc-primary-soft, #eaf2ff);
    color: var(--lc-text, #0f172a);
}

.public-help-header {
    min-height: 64px;
    border-bottom: 1px solid var(--lc-border, #dbe3ef);
    background: var(--lc-surface, #ffffff);
}

.public-help-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 32px, 1400px);
    min-height: 64px;
    margin: 0 auto;
}

.public-help-brand,
.public-help-signin {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
}

.public-help-brand {
    gap: 10px;
    color: var(--lc-text, #0f172a);
    font-size: 1rem;
    font-weight: 750;
}

.public-help-brand img {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.public-help-signin {
    justify-content: center;
    padding: 0 16px;
    border-radius: 8px;
    background: #2563eb;
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 700;
}

.public-help-signin:hover {
    background: #1d4ed8;
}

.public-help-signin:active {
    transform: translateY(1px);
}

.help-shell {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    grid-template-areas:
        "search article"
        "catalog article";
    gap: 16px 24px;
    align-items: start;
    width: min(100% - 48px, 1400px);
    margin: 0 auto;
    padding: 32px 0 48px;
}

.help-search-wrap {
    grid-area: search;
    position: sticky;
    top: var(--help-sticky-top);
    z-index: 1;
    padding-bottom: 2px;
    background: var(--lc-bg, #f4f7fb);
}

.help-search-wrap label {
    display: block;
    margin-bottom: 8px;
    color: var(--lc-text-secondary, #334155);
    font-size: 0.875rem;
    font-weight: 700;
}

.help-search-wrap input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 12px;
    background: var(--lc-surface, #ffffff);
    color: var(--lc-text, #0f172a);
    font: inherit;
    font-size: 1rem;
}

.help-search-wrap input::placeholder {
    color: #64748b;
    opacity: 1;
}

.help-search-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.help-main {
    grid-area: article;
    min-width: 0;
}

.help-article {
    border: 1px solid var(--lc-border, #dbe3ef);
    border-radius: 8px;
    padding: clamp(24px, 3vw, 40px);
    background: var(--lc-surface, #ffffff);
    box-shadow: var(--lc-shadow-md, 0 1px 2px rgb(15 23 42 / 0.06), 0 10px 24px rgb(15 23 42 / 0.05));
}

.help-article-kicker {
    margin: 0 0 10px;
    color: var(--lc-primary, #2563eb);
    font-size: 0.875rem;
    font-weight: 700;
}

.help-article h1 {
    max-width: 26ch;
    margin: 0;
    color: var(--lc-text, #0f172a);
    font-size: clamp(1.85rem, 3vw, 2.5rem);
    font-weight: 780;
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.help-summary {
    max-width: 70ch;
    margin: 14px 0 30px;
    color: var(--lc-text-muted, #526277);
    font-size: 1rem;
    line-height: 1.7;
}

.help-section,
.help-related {
    max-width: 78ch;
    border-top: 1px solid var(--lc-border-subtle, #e8eef5);
    padding-top: 24px;
    margin-top: 24px;
}

.help-section h2,
.help-related h2 {
    margin: 0 0 10px;
    color: var(--lc-text, #0f172a);
    font-size: 1.125rem;
    font-weight: 750;
    line-height: 1.35;
}

.help-section p {
    margin: 0 0 14px;
    color: var(--lc-text-secondary, #334155);
    font-size: 1rem;
    line-height: 1.72;
}

.help-section p:last-child {
    margin-bottom: 0;
}

.help-related-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 20px;
}

.help-related-list a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--lc-primary, #2563eb);
    font-size: 0.925rem;
    font-weight: 650;
    line-height: 1.35;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
}

.help-related-list a:hover {
    color: var(--lc-primary-hover, #1d4ed8);
    text-decoration-color: currentColor;
}

.help-browse {
    grid-area: catalog;
    position: sticky;
    top: calc(var(--help-sticky-top) + 76px);
    max-height: calc(100dvh - var(--help-sticky-top) - 92px);
    overflow: auto;
    scrollbar-gutter: stable;
}

.help-browse > summary,
.help-index-group > summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--lc-text, #0f172a);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.help-browse > summary::-webkit-details-marker,
.help-index-group > summary::-webkit-details-marker {
    display: none;
}

.help-browse > summary {
    pointer-events: none;
    font-size: 0.875rem;
}

.help-index {
    display: grid;
    gap: 6px;
    padding-right: 6px;
}

.help-index-group {
    border-bottom: 1px solid var(--lc-border-subtle, #e8eef5);
}

.help-index-group:last-child {
    border-bottom: 0;
}

.help-index-group > summary {
    position: relative;
    padding: 0 28px 0 4px;
    font-size: 0.875rem;
}

.help-index-group > summary::after,
.help-browse > summary::after {
    content: "";
    position: absolute;
    right: 6px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}

.help-index-group[open] > summary::after,
.help-browse[open] > summary::after {
    transform: rotate(225deg) translate(-1px, -1px);
}

.help-browse > summary::after {
    display: none;
}

.help-index-links {
    display: grid;
    gap: 2px;
    padding: 0 0 8px;
}

.help-index-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--lc-text-secondary, #334155);
    text-decoration: none;
}

.help-index-link:hover {
    background: var(--lc-surface-muted, #f8fafc);
    color: var(--lc-text, #0f172a);
}

.help-index-link.active {
    background: var(--lc-primary-soft, #eaf2ff);
    color: var(--lc-primary-hover, #1d4ed8);
}

.help-index-link span {
    font-size: 0.925rem;
    font-weight: 675;
    line-height: 1.35;
}

.help-index-link small {
    display: none;
    margin-top: 4px;
    color: var(--lc-text-muted, #526277);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.help-index-link.active small {
    display: block;
    color: var(--lc-primary-hover, #1d4ed8);
}

.help-empty {
    margin-bottom: 10px;
    border: 1px dashed var(--lc-border, #dbe3ef);
    border-radius: 8px;
    padding: 14px;
    background: var(--lc-surface, #ffffff);
    color: var(--lc-text-muted, #526277);
    font-size: 0.925rem;
    line-height: 1.5;
}

.help-empty[hidden],
.help-index-link[hidden],
.help-index-group[hidden] {
    display: none;
}

html.dark .help-search-wrap input,
html.dark-mode .help-search-wrap input {
    border-color: var(--lc-border, #334155);
}

html.dark .help-search-wrap input::placeholder,
html.dark-mode .help-search-wrap input::placeholder {
    color: #94a3b8;
}

@media (max-width: 767px) {
    body.help-page,
    body.help-page-authenticated {
        --help-sticky-top: 0px;
    }

    .help-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "search"
            "article"
            "catalog";
        gap: 18px;
        width: min(100% - 32px, 100%);
        padding: 22px 0 32px;
    }

    .help-search-wrap,
    .help-browse {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .help-article {
        margin-inline: -16px;
        border: 0;
        border-radius: 0;
        padding: 22px 16px 6px;
        box-shadow: none;
    }

    .help-article h1 {
        font-size: clamp(1.7rem, 8vw, 2.1rem);
    }

    .help-related-list {
        grid-template-columns: 1fr;
    }

    .help-browse {
        border-top: 1px solid var(--lc-border, #dbe3ef);
        padding-top: 6px;
    }

    .help-browse > summary {
        position: relative;
        pointer-events: auto;
        padding-right: 28px;
        font-size: 1rem;
    }

    .help-browse > summary::after {
        display: block;
    }

    .help-catalog {
        padding-top: 4px;
    }

    .help-shell.is-searching {
        grid-template-areas:
            "search"
            "catalog"
            "article";
    }

    .help-shell.is-searching .help-main {
        display: none;
    }
}

@media (max-width: 420px) {
    .public-help-header-inner {
        width: min(100% - 24px, 1400px);
    }

    .public-help-brand {
        gap: 8px;
    }

    .public-help-brand img {
        width: 30px;
        height: 30px;
    }
}
