/* Help page: a sticky contents/search column beside the reading column. Colors come from the app's
   --app-* variables, so the page follows the tenant theme and dark mode. */
.help-page {
    --help-sticky-top: 4.5rem; /* clears the fixed app header */
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    gap: 2rem;
    max-width: 1240px;
    padding: 1rem 0 2rem;
    color: var(--app-text-color);
}

.help-sidebar {
    position: sticky;
    top: var(--help-sticky-top);
    align-self: start;
    max-height: calc(100vh - var(--help-sticky-top) - 1rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.help-search {
    position: relative;
}

.help-search-icon {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-muted-color);
    pointer-events: none;
}

.help-search .form-control {
    padding-left: 2.1rem;
}

.help-search-status {
    min-height: 1.25rem;
    margin: .35rem 0 .5rem;
    color: var(--app-muted-color);
    font-size: var(--app-font-size-xs);
}

.help-toc {
    overflow-y: auto;
    min-height: 0;
    padding-right: .25rem;
    font-size: var(--app-font-size-small);
}

.help-toc-group {
    margin-bottom: .6rem;
}

.help-toc a {
    display: block;
    padding: .15rem .5rem;
    border-radius: .25rem;
    color: var(--app-muted-color);
    text-decoration: none;
}

.help-toc a:hover {
    background: var(--app-surface-hover);
    color: var(--app-text-color);
}

.help-toc .help-toc-section {
    color: var(--app-text-color);
    font-weight: 600;
}

.help-toc .help-toc-section.active {
    background: var(--app-surface-strong);
    box-shadow: inset 3px 0 0 var(--app-text-color);
}

.help-toc ul {
    list-style: none;
    margin: .1rem 0 0 .5rem;
    padding-left: .6rem;
    border-left: 1px solid var(--app-border-muted);
}

.help-content {
    min-width: 0;
    max-width: 52rem;
    line-height: 1.6;
}

.help-content a {
    color: var(--app-link-color);
    text-decoration: underline;
}

/* Staff guide / borrower guide switcher. */
.help-guides {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--app-border-color);
}

.help-content .help-guide-tab {
    padding: .45rem .85rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--app-muted-color);
    font-weight: 500;
    text-decoration: none;
}

.help-content .help-guide-tab:hover {
    color: var(--app-text-color);
}

.help-content .help-guide-tab.active {
    border-bottom-color: var(--app-text-color);
    color: var(--app-text-color);
    font-weight: 600;
}

.help-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.help-lede {
    font-size: 1.05rem;
}

.help-meta {
    color: var(--app-muted-color);
    font-size: var(--app-font-size-small);
}

.help-empty {
    padding: 1rem;
    border: 1px dashed var(--app-border-color);
    border-radius: .5rem;
    color: var(--app-muted-color);
}

.help-section {
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--app-border-muted);
    scroll-margin-top: var(--help-sticky-top);
}

.help-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .75rem;
}

.help-topic {
    margin-bottom: 1.5rem;
    scroll-margin-top: var(--help-sticky-top);
}

.help-topic h3 {
    font-size: 1.08rem;
    font-weight: 650;
    margin-bottom: .4rem;
}

.help-topic p,
.help-topic ul,
.help-topic ol {
    margin-bottom: .6rem;
}

.help-topic li + li {
    margin-top: .15rem;
}

.help-table {
    width: 100%;
    margin: .5rem 0 .9rem;
    border-collapse: collapse;
    font-size: var(--app-font-size-small);
}

.help-table th,
.help-table td {
    padding: .35rem .6rem;
    border: 1px solid var(--app-border-muted);
    vertical-align: top;
    text-align: left;
}

.help-table th {
    background: var(--app-surface-strong);
    font-weight: 600;
}

/* A path drawn as a row of chips joined by arrows. */
.help-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1.4rem;
    margin: .5rem 0 .9rem;
    padding: 0;
    list-style: none;
    font-size: var(--app-font-size-xs);
}

.help-flow li {
    position: relative;
    padding: .2rem .6rem;
    border: 1px solid var(--app-border-color);
    border-radius: 999px;
    background: var(--app-surface-strong);
    font-weight: 600;
}

.help-flow li + li {
    margin-top: 0;
}

.help-flow li + li::before {
    content: "\2192";
    position: absolute;
    left: -1.1rem;
    color: var(--app-muted-color);
    font-weight: 400;
}

.help-note {
    margin: .6rem 0 .9rem;
    padding: .6rem .85rem;
    border-left: 3px solid var(--app-border-color);
    border-radius: .25rem;
    background: var(--app-surface);
}

.help-note p:last-child {
    margin-bottom: 0;
}

.help-note-warn {
    border-left-color: #b26a00;
}

.help-back {
    margin-top: 1.5rem;
}

mark.help-hit {
    padding: 0 .1rem;
    border-radius: .15rem;
    background: #ffe58a;
    color: #171717;
}

@media (max-width: 991.98px) {
    .help-page {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .help-sidebar {
        position: static;
        max-height: none;
    }

    .help-toc {
        max-height: 14rem;
    }
}
