/* 166 — the in-console help: the help icon (#help-btn, the DS .icon-btn), the side panel (aside#help-panel), the /help
   page (main#help-page) and the topic typography (.help-body, which the Documentation section's preview reuses).
   One stylesheet for every partner shell: v1, v2 (light and dark), v3 and the N7 Client Admin. It reads only the custom
   properties v2, v3 and the n7 looks define; v1 lacks some of them, and the block below defines them from v1's own
   palette, scoped to the help's own elements (the 167 sa-shell.css pattern), so nothing else on a v1 page changes.
   v2 dark needs no rule: its [data-theme="dark"] block defines every property read here (checked: --surface,
   --heading, --muted-foreground, --default, --border, --accent-soft, --accent-soft-foreground, --danger-soft,
   --danger-soft-foreground, --shadow-overlay). admin.html, index.html and help.html load this file after ds-switch.js,
   so it comes after #ds-css and survives a look hot-swap. The ds/* stylesheets are not edited (v1 is never restyled).
   Contrast: text reads --foreground, --heading or --muted-foreground on --surface or --default; links and the note's
   mark read --accent-soft-foreground (>= 4.5:1 on --surface in every look); the failure line
   --danger-soft-foreground on --danger-soft. The open topic and the pressed language are a tint, never a second
   primary action: the help has no primary button. */

/* --- v1 (a partner shell fixed on the v1 look) ------------------------------------------------------------------------ */
html[data-ds="v1"] :is(.help-panel, .help-page, .help-body, #help-btn) {
  --surface: var(--white); --accent-soft: var(--light-blue); --accent-soft-foreground: var(--navy);
  --default: var(--neutral); --separator: var(--line); --radius-sm: var(--radius); --radius-lg: var(--radius-dialog);
  --shadow-overlay: -4px 0 24px rgba(22,26,46,.12), 0 2px 6px rgba(22,26,46,.06);
  --danger-soft: #FDECEC; --danger-soft-foreground: #B42318; --ease: ease;
}

/* --- the panel: on the right, below the top bar, no scrim; the console stays visible beside it ----------------------- */
.help-panel { position: fixed; top: var(--help-top, 0px); right: 0; bottom: 0; z-index: 35; width: 420px; max-width: 100vw;
  display: flex; flex-direction: column; min-height: 0; background: var(--surface); color: var(--foreground);
  box-shadow: var(--shadow-overlay), inset 1px 0 0 var(--border); font: 400 14px/20px var(--font-sans); }
.help-panel[hidden] { display: none; }
@media (max-width: 760px) { .help-panel { left: 0; width: auto; } }

.help-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; min-width: 0; }
.help-title { flex: 1; min-width: 0; margin: 0; font: 600 16px/24px var(--font-sans); color: var(--heading); }
.help-close { flex: none; }

/* the reader's BG / EN toggle: a small segmented pair; the pressed one is a tint */
.help-langs { flex: none; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--default); }
.help-lang { min-width: 40px; min-height: 32px; padding: 0 10px; border: 0; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; color: var(--muted-foreground); font: 600 12px/16px var(--font-sans); letter-spacing: .04em; cursor: pointer; }
.help-lang:hover { color: var(--heading); }
.help-lang[aria-pressed="true"] { background: var(--surface); color: var(--heading); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.help-lang:focus-visible { outline: none; box-shadow: var(--ring-focus); }

.help-search-wrap { padding: 0 16px 12px; }
.help-search { width: 100%; }

.help-error, .help-signin { margin: 0 16px 12px; padding: 10px 12px; border-radius: var(--radius-sm); font: 400 14px/20px var(--font-sans); }
.help-error { background: var(--danger-soft); color: var(--danger-soft-foreground); }
.help-signin { background: var(--default); color: var(--foreground); }
.help-signin a { color: var(--accent-soft-foreground); font-weight: 600; }
.help-error[hidden], .help-signin[hidden] { display: none; }

.help-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 20px; box-shadow: inset 0 1px 0 var(--border); scrollbar-width: thin; }
.help-foot { flex: none; display: flex; justify-content: flex-end; padding: 10px 16px; box-shadow: inset 0 1px 0 var(--border); }
.help-page-link { color: var(--accent-soft-foreground); font: 500 14px/20px var(--font-sans); text-decoration: underline; text-underline-offset: 3px; }
.help-page-link:hover { color: var(--heading); }

/* --- the topic list, grouped by goal --------------------------------------------------------------------------------- */
.help-list { display: grid; gap: 14px; margin-top: 20px; padding-top: 16px; box-shadow: inset 0 1px 0 var(--border); }
.help-list[hidden] { display: none; }
.help-list-head { margin: 0; font: 600 12px/16px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.help-group { display: grid; gap: 2px; min-width: 0; }
.help-group-title { margin: 0 0 4px; font: 600 13px/18px var(--font-sans); color: var(--heading); }
.help-topic { display: block; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--foreground); font: 400 14px/20px var(--font-sans); text-align: left; cursor: pointer; }
.help-topic:hover { background: var(--default); color: var(--heading); }
.help-topic[aria-current="true"] { background: var(--accent-soft); color: var(--heading); font-weight: 600; }
.help-topic:focus-visible, .help-hit-title:focus-visible { outline: none; box-shadow: var(--ring-focus); }

/* --- the panel's topic list on the left (the owner, 22.10.2026: "the menu with the help items should be on the left,
   like the technical book, so the user can see the topics"). From 1100 px the panel is 640 px wide in two columns, the
   list (200 px) and the topic, each scrolling on its own; below 1100 px the panel keeps one column and the list folds
   above the topic behind a toggle that names the open topic. .help-side is shared with the /help page: every rule here
   is scoped to .help-panel. ------------------------------------------------------------------------------------------ */
.help-panel .help-side { position: static; min-width: 0; }
.help-panel .help-list { margin-top: 0; padding-top: 0; box-shadow: none; }
.help-topics-toggle { display: none; }
@media (min-width: 1100px) {
  .help-panel { width: 640px; }
  .help-panel .help-scroll { display: grid; grid-template-columns: 200px minmax(0, 1fr); padding: 0; overflow: hidden; }
  .help-panel .help-side { overflow-y: auto; padding: 12px 8px 20px 12px; box-shadow: inset -1px 0 0 var(--border); scrollbar-width: thin; }
  .help-panel .help-main { min-width: 0; overflow-y: auto; padding: 4px 16px 20px; scrollbar-width: thin; }
  .help-panel .help-list-head { padding: 0 2px; }
  .help-panel .help-topic { padding: 6px 8px; min-height: 32px; font-size: 13px; line-height: 18px; }
}
@media (max-width: 1099.98px) {
  .help-panel .help-side { margin: 8px 0 4px; }
  .help-panel .help-topics-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 12px;
    border: 0; border-radius: var(--radius-sm); background: var(--default); color: var(--heading); font: 600 14px/20px var(--font-sans);
    text-align: left; cursor: pointer; }
  .help-panel .help-topics-toggle:focus-visible { outline: none; box-shadow: var(--ring-focus); }
  .help-panel .help-topics-toggle::after { content: ""; flex: none; width: 8px; height: 8px; margin: 0 2px 3px auto;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .help-panel[data-help-topics-open] .help-topics-toggle::after { margin-bottom: -3px; transform: rotate(-135deg); }
  .help-topics-toggle-label { flex: none; }
  .help-topics-toggle-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; color: var(--muted-foreground); }
  .help-topics-toggle-current:not(:empty)::before { content: "· "; }
  .help-panel:not([data-help-topics-open]) .help-list { display: none; }
  .help-panel .help-list { margin-top: 10px; padding-bottom: 12px; box-shadow: inset 0 -1px 0 var(--border); }
  .help-panel .help-list-head { display: none; }
}
.help-panel[data-help-searching] .help-topics-toggle { display: none; }

/* --- the search hits ------------------------------------------------------------------------------------------------- */
.help-hits { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.help-hits[hidden], .help-empty[hidden] { display: none; }
.help-hit { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--border); }
.help-hit-title { justify-self: start; padding: 0; border: 0; background: none; color: var(--heading); font: 600 14px/20px var(--font-sans);
  text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); }
.help-hit-title:hover { text-decoration-color: currentColor; }
.help-hit-line { display: block; color: var(--muted-foreground); font: 400 13px/18px var(--font-sans); overflow-wrap: anywhere; }
.help-empty { margin: 12px 0 0; color: var(--muted-foreground); }

/* --- the topic text (the panel, the page and the Documentation section's preview) ------------------------------------ */
.help-body { color: var(--foreground); font: 400 14px/22px var(--font-sans); overflow-wrap: break-word; }
.help-body[hidden] { display: none; }
.help-body:focus { outline: none; }
.help-body .help-topic-title { margin: 12px 0 10px; font: 600 20px/28px var(--font-sans); letter-spacing: -0.005em; color: var(--heading); }
.help-body h2 { margin: 22px 0 6px; font: 600 17px/24px var(--font-sans); color: var(--heading); }
.help-body h3 { margin: 18px 0 4px; font: 600 15px/22px var(--font-sans); color: var(--heading); }
.help-body h4 { margin: 14px 0 4px; font: 600 14px/20px var(--font-sans); color: var(--heading); }
.help-body .help-text > :first-child { margin-top: 0; }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 22px; }
.help-body li { margin: 3px 0; }
.help-body li > ul, .help-body li > ol { margin: 4px 0 0; }
.help-body strong { font-weight: 600; color: var(--heading); }
.help-body code { padding: 1px 5px; border-radius: 4px; background: var(--default); color: var(--foreground); font: 500 13px/1.4 var(--font-mono); }
.help-body a { color: var(--accent-soft-foreground); text-decoration: underline; text-underline-offset: 3px; }
.help-body a:hover { color: var(--heading); }
.help-body .help-note { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--default);
  box-shadow: inset 3px 0 0 var(--accent-soft-foreground); }
.help-body .help-note > :last-child { margin-bottom: 0; }
.help-body hr { margin: 18px 0; border: 0; height: 1px; background: var(--border); }

/* --- the /help page: the list beside the open topic, full width ----------------------------------------------------- */
html[data-shell="help"] body { min-height: 100%; height: auto; display: flex; flex-direction: column; }
html[data-shell="help"] .topbar { flex: none; }
.help-page { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; box-sizing: border-box;
  display: flex; flex-direction: column; min-width: 0; color: var(--foreground); font: 400 14px/20px var(--font-sans); }
.help-page .help-head { padding: 0 0 16px; }
.help-page .help-title { font: 600 14px/20px var(--font-sans); color: var(--muted-foreground); letter-spacing: .02em; }
.help-page .help-scroll { flex: none; overflow: visible; padding: 0; box-shadow: none; display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 32px; align-items: start; }
.help-side { position: sticky; top: 16px; display: grid; gap: 0; min-width: 0; }
.help-page .help-search-wrap { padding: 0 0 4px; }
.help-page .help-list { margin-top: 12px; padding-top: 12px; }
.help-content { min-width: 0; max-width: 800px; padding: 24px 32px 28px; border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border); }
.help-content .help-error, .help-content .help-signin { margin: 0 0 12px; }
.help-page .help-body .help-topic-title { margin-top: 0; font-size: 24px; line-height: 32px; }
@media (max-width: 760px) {
  .help-page { padding: 16px; }
  .help-page .help-scroll { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .help-side { position: static; }
  .help-content { padding: 16px; }
}

/* 166 (the CI run after the merge): the help icon made the Client Admin top bar overflow at 1280 on screens that already
   carry every control (v2 by 7 to 49 px, n7-4 by 17 px): every item of the bar is fixed but the site name, which the
   looks hold at 150 px or more. On a crowded bar the site name now shrinks down to 96 px (an ellipsis); with room it keeps
   its full width. */
html .topbar .crumb-wrap { min-width: 96px; }
html .topbar #crumb-btn { min-width: 0; }
html .topbar #crumb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
