/* ==================================================================
   Help Centre — in-admin documentation surface.

   Long-form prose, the guide index and the glossary. Every colour is
   drawn from the --t-* semantic tokens (admin-overrides.css) so light
   and dark modes are handled automatically — there are deliberately no
   Tailwind dark: variants here (many fail silently against Unfold's
   prebuilt bundle — see docs/system/design/dark-mode.md).

   Loaded globally via UNFOLD["STYLES"], so .help-prose is also styled
   inside the record-peek drawer used for contextual (fragment) help.
   ================================================================== */

/* ---- Guide index toolbar + search ------------------------------- */
.help-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}
.help-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.help-search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--color-base-400);
    pointer-events: none;
}
.help-search {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--t-border-bright);
    border-radius: var(--border-radius);
    background: var(--t-surface);
    color: var(--t-ink);
    font-family: var(--font-sans);
    font-size: 14px;
}
.help-search:focus {
    outline: none;
    border-color: var(--t-primary);
    box-shadow: 0 0 0 3px var(--t-focus-ring);
}

/* ---- Guide index sections + cards ------------------------------- */
.help-section {
    margin-bottom: 30px;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.help-card {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    background: var(--t-surface);
    border: 1px solid var(--t-border-hairline);
    border-radius: 9px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.help-card:hover {
    border-color: var(--t-border-bright);
    box-shadow: 0 2px 10px rgba(31, 44, 72, 0.08);
}
.help-card__icon {
    color: var(--t-primary);
    font-size: 22px;
    flex: none;
    margin-top: 1px;
}
.dark .help-card__icon {
    color: var(--t-info);
}
.help-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.help-card__title {
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--t-ink);
}
.help-card__summary {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--color-base-500);
}
.help-empty {
    padding: 40px;
    text-align: center;
    color: var(--color-base-500);
    font-size: 14px;
}

/* ---- Article page ----------------------------------------------- */
.help-article {
    max-width: 860px;
}
.help-related {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding: 16px 20px;
    background: var(--t-surface-raised);
    border: 1px solid var(--t-border-hairline);
    border-radius: 9px;
}
.help-related__title {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-base-400);
    margin: 0 0 8px;
}
.help-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
a.th-chip {
    text-decoration: none;
}
.help-related__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.help-related__list a {
    color: var(--t-primary);
    text-decoration: none;
    font-size: 13.5px;
}
.dark .help-related__list a {
    color: var(--t-info);
}
.help-related__list a:hover {
    text-decoration: underline;
}

/* ---- Glossary --------------------------------------------------- */
.help-glossary {
    max-width: 860px;
}
.help-term {
    padding: 18px 0;
    border-bottom: 1px solid var(--t-border-hairline);
    scroll-margin-top: 90px;
}
.help-term:first-child {
    padding-top: 0;
}
.help-term:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.help-term__name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--t-ink);
    margin: 0 0 6px;
}
.help-term:target .help-term__name {
    color: var(--t-primary);
}
.dark .help-term:target .help-term__name {
    color: var(--t-info);
}

/* ---- Long-form prose (articles, glossary bodies, drawer) -------- */
.help-prose {
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--t-ink);
}
.help-prose > :first-child {
    margin-top: 0;
}
.help-prose > :last-child {
    margin-bottom: 0;
}
.help-prose h2 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--t-ink);
    margin: 30px 0 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--t-border-hairline);
}
.help-prose h3 {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--t-ink);
    margin: 24px 0 8px;
}
.help-prose h4 {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-base-500);
    margin: 20px 0 6px;
}
.help-prose p {
    margin: 0 0 14px;
}
.help-prose ul,
.help-prose ol {
    margin: 0 0 14px;
    padding-left: 22px;
}
.help-prose li {
    margin-bottom: 6px;
}
.help-prose li::marker {
    color: var(--t-disabled);
}
.help-prose a {
    color: var(--t-primary);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--t-primary) 35%, transparent);
    text-underline-offset: 3px;
}
.dark .help-prose a {
    color: var(--t-info);
}
.help-prose a:hover {
    color: var(--t-primary-hover);
}
.help-prose strong {
    font-weight: 600;
    color: var(--t-ink);
}
.help-prose em {
    font-style: italic;
}
.help-prose code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    padding: 1px 5px;
    background: var(--t-page);
    border: 1px solid var(--t-border-hairline);
    border-radius: 5px;
}
.help-prose pre {
    background: var(--t-surface-raised);
    border: 1px solid var(--t-border-hairline);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 0 0 16px;
}
.help-prose pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 12.5px;
}
.help-prose blockquote {
    margin: 0 0 16px;
    padding: 8px 16px;
    border-left: 3px solid var(--t-primary);
    background: var(--t-info-dim);
    color: var(--color-base-600);
    border-radius: 0 8px 8px 0;
}
.help-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 13px;
}
.help-prose th,
.help-prose td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--t-border-hairline);
    vertical-align: top;
}
.help-prose thead th {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-base-500);
}
.help-prose hr {
    border: 0;
    border-top: 1px solid var(--t-border-hairline);
    margin: 24px 0;
}

/* ---- Contextual fragment inside the peek drawer ----------------- */
.help-fragment {
    font-size: 14px;
}
.help-fragment .help-prose {
    font-size: 13.5px;
    line-height: 1.65;
}
.help-fragment .help-prose h2 {
    font-size: 16px;
    margin-top: 22px;
}
.help-fragment__full {
    display: inline-block;
    margin-top: 16px;
    color: var(--t-primary);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
}
.dark .help-fragment__full {
    color: var(--t-info);
}

/* ---- Help drawer: in-context browsing launched from the top bar ---- */
.help-drawer-search {
    position: relative;
    margin-bottom: 14px;
}
.help-drawer-search .material-symbols-outlined {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--color-base-400);
    pointer-events: none;
}
.help-drawer-search input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 32px;
    border: 1px solid var(--t-border-bright);
    border-radius: var(--border-radius);
    background: var(--t-surface);
    color: var(--t-ink);
    font-family: var(--font-sans);
    font-size: 13px;
}
.help-drawer-search input:focus {
    outline: none;
    border-color: var(--t-primary);
    box-shadow: 0 0 0 3px var(--t-focus-ring);
}
.help-drawer-section {
    margin-bottom: 18px;
}
.help-drawer-section__title {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-base-400);
    margin: 0 0 8px;
}
.help-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.help-drawer-link {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}
.help-drawer-link:hover {
    background: var(--t-row-hover);
    border-color: var(--t-border-hairline);
}
.help-drawer-link .material-symbols-outlined {
    font-size: 18px;
    color: var(--t-primary);
    flex: none;
    margin-top: 1px;
}
.dark .help-drawer-link .material-symbols-outlined {
    color: var(--t-info);
}
.help-drawer-link__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.help-drawer-link__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--t-ink);
}
.help-drawer-link__summary {
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-base-500);
}
.help-drawer-link--feature {
    margin-top: 6px;
    border-color: var(--t-border-hairline);
    background: var(--t-surface-raised);
}
.help-drawer-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--t-primary);
    text-decoration: none;
    margin-bottom: 12px;
}
.dark .help-drawer-back {
    color: var(--t-info);
}
.help-drawer-back .material-symbols-outlined {
    font-size: 18px;
}
.help-drawer-back:hover {
    text-decoration: underline;
}
.help-glossary-fragment .help-term {
    padding: 12px 0;
    scroll-margin-top: 12px;
}
.help-glossary-fragment .help-term:first-child {
    padding-top: 0;
}
.help-glossary-fragment .help-term__name {
    font-size: 14px;
}

/* ---- Insights sub-group (mirrors the sidebar's "Insights" grouping) ---- */
/* Full home page: a labelled sub-heading above the report cards. */
.help-subhead {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--t-primary);
    margin: 0 0 10px;
}
.dark .help-subhead {
    color: var(--t-info);
}
.help-subhead .material-symbols-outlined {
    font-size: 16px;
}
.help-grid--after-insights {
    margin-top: 18px;
}
/* Drawer: the report guides sit in a subtly raised, bordered box. */
.help-drawer-insights {
    background: var(--t-surface-raised);
    border: 1px solid var(--t-border-hairline);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}
.help-drawer-subhead {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--t-primary);
    margin: 2px 4px 8px;
}
.dark .help-drawer-subhead {
    color: var(--t-info);
}
.help-drawer-subhead .material-symbols-outlined {
    font-size: 15px;
}
