/* ============================================
   SHARED_HELP — Reusable Help Center Styles
   Drop-in CSS for any OTROTL site.
   Override --help-accent in site CSS to brand.
   ALL values in rem. ZERO px.
   ============================================ */

/* --------------------------------------------------------------------------
   CSS Variables - Help Module
   -------------------------------------------------------------------------- */
:root {
    /* Inherit the consuming site's brand; the literal is the historical
       default, so an unthemed site computes byte-identically. */
    --help-accent: var(--site-accent-fill, #f97316);
    --help-accent-light: var(--site-accent-tint, rgba(249, 115, 22, 0.1));
    --help-accent-hover: var(--site-accent-hover, #ea580c);
    /* Accent used AS TEXT on the surface (links, inline code): the hub's
       AA-clamped ink, with today's per-theme literal as the fallback. */
    --help-accent-ink: var(--site-accent-ink, #ea580c);

    /* Site-owned tokens (SHARED_THEMING_CONTRACT section 3.1), LIGHT values.
       Each reads the site's --site-* role with today's literal as the
       fallback, so a site that publishes none computes exactly as before
       (frontend/tests/help-token-invariant.test.js pins that). The DARK
       values are in the block below. */
    --help-bg: var(--site-bg, #ffffff);
    --help-surface: var(--site-surface, #f9fafb);
    --help-surface-2: var(--site-surface-2, #f3f4f6);
    --help-border: var(--site-border, #e5e7eb);
    --help-text: var(--site-text, #1f2937);
    --help-text-muted: var(--site-text-muted, #6b7280);
    --help-focus: var(--site-focus, var(--help-accent));
    --help-font-body: var(--site-font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --help-font-mono: var(--site-font-mono, 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace);
    /* Private shades. Where a site role is the same job, it is the fallback
       chain's first step; where none is, the token is the literal alone. */
    --help-text-strong: var(--site-text, #111827);      /* headings, table heads */
    --help-text-soft: var(--site-text-muted, #4b5563);  /* article body copy */
    --help-text-faint: #9ca3af;                         /* icons, counts, separators */
    --help-control-text: #374151;                       /* icon/footer button ink */
    --help-field: #ffffff;                              /* search inputs, dropdowns */
    --help-hover: #f3f4f6;                              /* list-row hover */
    --help-field-border: #d1d5db;                       /* input borders */
    /* Further private shades (no site role). Theme-invariant ones are defined
       here only; the rest switch in the dark block below. */
    --help-line-strong: #d1d5db;
    --help-code-border: #e5e7eb;
    --help-code-bg: #f9fafb;
    --help-code-text: #1f2937;
    --help-panel: #ffffff;
    --help-text-h3: #1f2937;
    --help-link-hover: var(--help-accent);
    --help-field-focus: #fffbf7;
    --help-shadow: rgba(0, 0, 0, 0.1);
    --help-on-accent: var(--site-on-accent, #ffffff);
    --help-overlay: rgba(0, 0, 0, 0.5);
    --help-toast-bg: #1f2937;
    --help-toast-text: #ffffff;
    --help-drop-shadow: rgba(0, 0, 0, 0.1);
    --help-drop-shadow-near: rgba(0, 0, 0, 0.06);
    --help-row-tint: rgba(156, 163, 175, 0.1);
    --help-dim: #6b7280;
    --help-tree-marker-hover: #9ca3af;
    --help-print-text: #333333;
    --help-print-border: #cccccc;
    --help-print-code-bg: #f5f5f5;
    --help-print-th-bg: #eeeeee;
    --help-callout-info: #3b82f6;
    --help-callout-warning: #f59e0b;
    --help-callout-success: #10b981;
    --help-callout-danger: #ef4444;
    --help-callout-tip: #8b5cf6;
    --help-callout-info-bg: rgba(59, 130, 246, 0.06);
    --help-callout-warning-bg: rgba(245, 158, 11, 0.06);
    --help-callout-success-bg: rgba(16, 185, 129, 0.06);
    --help-callout-danger-bg: rgba(239, 68, 68, 0.06);
    --help-callout-tip-bg: rgba(139, 92, 246, 0.06);
    --help-callout-info-text: #1e40af;
    --help-callout-warning-text: #92400e;
    --help-callout-success-text: #065f46;
    --help-callout-danger-text: #991b1b;
    --help-callout-tip-text: #5b21b6;
    --help-callout-code-bg: rgba(0, 0, 0, 0.06);
    --help-scrollbar-thumb: rgba(156, 163, 175, 0.4);
    --help-scrollbar-thumb-hover: rgba(156, 163, 175, 0.7);
    --help-nav-thumb: rgba(156, 163, 175, 0.4);
    --help-header-glow: rgba(249, 115, 22, 0.04);
    --help-active-bg: rgba(249, 115, 22, 0.06);
    --help-highlight-bg: rgba(249, 115, 22, 0.15);
    --help-card-hover-shadow: rgba(249, 115, 22, 0.1);
    --help-icon-bg: rgba(156, 163, 175, 0.1);
    --help-icon-active-bg: rgba(249, 115, 22, 0.12);
    --help-icon-hover-bg: var(--help-accent-light);
    --help-item-active-bg: rgba(249, 115, 22, 0.08);
    --help-quote-bg: rgba(249, 115, 22, 0.04);
    --help-focus-glow: rgba(249, 115, 22, 0.15);
    --help-focus-inset: rgba(0, 0, 0, 0.06);
    --help-tree-hover: rgba(243, 244, 246, 0.7);
    --help-svg-line: #d1d5db;                           /* workflow diagram arrows (both themes) */

    /* Page chrome (help.html and the markup help-app.js builds). These
       replace the Tailwind colour utilities the page carried until 0f8ce5d;
       each fallback is that utility's value in the vendored Tailwind 3.4
       build, so an unthemed site paints exactly as before
       (frontend/tests/help-chrome-tokens.test.js). Chrome that reuses an
       existing token (--help-border, --help-text-muted, --help-text-faint,
       --help-text-strong, --help-hover, --help-dim, --help-overlay,
       --help-accent) defines nothing new here. */
    --help-page-bg: var(--site-bg, #ffffff);            /* body, centre column */
    /* Body font. Unthemed, the page renders in the vendored Tailwind's
       html stack (its preflight sets it; body inherits), NOT in
       --help-font-body's fallback, so the page reads this token instead. */
    --help-page-font: var(--site-font-body, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --help-input-bg: var(--site-surface-2, #f3f4f6);
    --help-input-border: var(--site-border, #e5e7eb);
    --help-close-hover: #e5e7eb;
    --help-logo-from: var(--site-grad-start, var(--site-accent-fill, #f97316));
    --help-logo-to: var(--site-grad-end, var(--site-accent-fill, #f59e0b));
    --help-on-logo: var(--site-on-grad, var(--site-on-accent, #ffffff));
    --help-crumb-sep: #d1d5db;
    /* Tailwind ordered dark: after hover:, so in dark the home link's hover
       never showed the accent; the dark value below keeps that. */
    --help-crumb-home-hover: var(--help-accent);
    --help-crumb-link-hover: #3b82f6;                   /* runtime breadcrumb links */
    --help-crumb-current: var(--site-text, #111827);
    --help-feedback-idle: #9ca3af;
    --help-feedback-yes: #22c55e;
    --help-feedback-yes-bg: #f0fdf4;
    --help-feedback-no: #ef4444;
    --help-feedback-no-bg: #fef2f2;
    --help-error-icon: #f87171;

    --help-sidebar-left-w: 17.5rem;
    --help-sidebar-right-w: 16.25rem;
    --help-header-h: 3.75rem;
    --help-touch-min: 2.75rem;
    --help-transition: 0.25s ease;
    --help-radius: var(--site-radius, 0.5rem);
    --help-radius-lg: var(--site-radius-lg, 0.75rem);
    --help-radius-2xs: 0.125rem;
    --help-radius-xs: 0.1875rem;
    --help-radius-sm: 0.25rem;
    --help-radius-md: 0.375rem;
    --help-radius-round: 50%;
    --help-font-callout-code: 'Courier New', monospace;
    --help-gap: 1rem;
    --help-gap-sm: 0.5rem;
    --help-gap-lg: 1.5rem;
    --help-gap-xl: 2rem;
    --help-font-xs: 0.75rem;
    --help-font-sm: 0.8125rem;
    --help-font-base: 0.9375rem;
    --help-font-lg: 1.125rem;
    --help-font-xl: 1.5rem;
    --help-font-2xl: 2rem;
}

/* DARK values of the site-owned and private tokens above.
   The data-theme ATTRIBUTE is authoritative: theme-hydrate.js stamps it (and
   mirrors html.dark). The html.dark CLASS counts only on a page whose <html>
   carries NO data-theme attribute -- a page served without theme-hydrate.js,
   where help-theme-init.js toggles the class alone (contract T3). So a
   data-theme="light" page is light here even if a stale .dark class lingers.
   html[data-theme="light"] needs no block of its own: it falls through to
   :root. This mirrors tools-shared-ecommerce's ecommerce.css gate, minus its
   prefers-color-scheme block: the OS preference is resolved by
   theme-hydrate.js, never by this file (contract section 3.3).
   color-scheme is deliberately NOT set here: the contract puts it on the
   site's own token block, and setting it from this file would repaint native
   scrollbars and form controls for every unthemed site. */
html[data-theme="dark"],
html.dark:not([data-theme]) {
    --help-accent-ink: var(--site-accent-ink, #f97316);
    --help-bg: var(--site-bg, #030712);
    --help-surface: var(--site-surface, #111827);
    --help-surface-2: var(--site-surface-2, #1f2937);
    --help-border: var(--site-border, #374151);
    --help-text: var(--site-text, #f3f4f6);
    --help-text-muted: var(--site-text-muted, #9ca3af);
    --help-text-strong: var(--site-text, #f3f4f6);
    --help-text-soft: var(--site-text-muted, #9ca3af);
    --help-text-faint: #6b7280;
    --help-control-text: #d1d5db;
    --help-field: #1f2937;
    --help-hover: #374151;
    --help-field-border: #374151;
    --help-line-strong: #4b5563;
    --help-code-border: #1e293b;
    --help-code-bg: #0f172a;
    --help-code-text: #e2e8f0;
    --help-panel: #111827;
    --help-text-h3: #e5e7eb;
    --help-link-hover: #fb923c;
    --help-field-focus: #1a1a2e;
    --help-shadow: rgba(0, 0, 0, 0.4);
    --help-callout-info-bg: rgba(59, 130, 246, 0.1);
    --help-callout-warning-bg: rgba(245, 158, 11, 0.1);
    --help-callout-success-bg: rgba(16, 185, 129, 0.1);
    --help-callout-danger-bg: rgba(239, 68, 68, 0.1);
    --help-callout-tip-bg: rgba(139, 92, 246, 0.1);
    --help-callout-info-text: #93c5fd;
    --help-callout-warning-text: #fcd34d;
    --help-callout-success-text: #6ee7b7;
    --help-callout-danger-text: #fca5a5;
    --help-callout-tip-text: #c4b5fd;
    --help-callout-code-bg: rgba(255, 255, 255, 0.1);
    --help-scrollbar-thumb: rgba(55, 65, 81, 0.5);
    --help-scrollbar-thumb-hover: rgba(75, 85, 99, 0.8);
    --help-nav-thumb: rgba(55, 65, 81, 0.6);
    --help-header-glow: rgba(249, 115, 22, 0.06);
    --help-active-bg: rgba(249, 115, 22, 0.1);
    --help-highlight-bg: rgba(249, 115, 22, 0.25);
    --help-card-hover-shadow: rgba(0, 0, 0, 0.3);
    --help-icon-bg: rgba(75, 85, 99, 0.2);
    --help-icon-active-bg: rgba(249, 115, 22, 0.15);
    --help-icon-hover-bg: rgba(249, 115, 22, 0.12);
    --help-item-active-bg: rgba(249, 115, 22, 0.12);
    --help-quote-bg: rgba(249, 115, 22, 0.08);
    --help-focus-glow: rgba(249, 115, 22, 0.2);
    --help-focus-inset: rgba(0, 0, 0, 0.2);
    --help-tree-hover: rgba(31, 41, 55, 0.7);
    /* Page chrome, dark (see the light block). */
    --help-page-bg: var(--site-bg, #111827);
    --help-input-bg: var(--site-surface-2, #374151);
    --help-input-border: var(--site-border, #4b5563);
    --help-close-hover: #374151;
    --help-crumb-sep: #4b5563;
    --help-crumb-home-hover: var(--help-text-faint);
    --help-crumb-link-hover: #60a5fa;
    --help-crumb-current: var(--site-text, #ffffff);
    --help-feedback-yes-bg: rgba(20, 83, 45, 0.2);
    --help-feedback-no-bg: rgba(127, 29, 29, 0.2);
}

/* --------------------------------------------------------------------------
   1. Layout Grid (.help-layout)
   -------------------------------------------------------------------------- */
body.help-body {
    padding-top: var(--help-header-h);
}

.help-layout {
    display: grid;
    grid-template-columns: var(--help-sidebar-left-w) 1fr 0;
    min-height: calc(100vh - var(--help-header-h));
    /* Kept as literals + a .dark rule on purpose: help-token-invariant.test.js
       pins this exact pair as its mutation fixture (tests 3 and 4). */
    background: #ffffff;
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: grid-template-columns var(--help-transition);
}

.help-layout.toc-open {
    grid-template-columns: var(--help-sidebar-left-w) 1fr var(--help-sidebar-right-w);
}

.dark .help-layout {
    background: #030712;
    color: #f3f4f6;
}

/* --------------------------------------------------------------------------
   2. Left Sidebar (.help-sidebar-left)
   -------------------------------------------------------------------------- */
.help-sidebar-left {
    position: sticky;
    top: var(--help-header-h);
    height: calc(100vh - var(--help-header-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--help-surface);
    border-right: 0.0625rem solid var(--help-border);
    z-index: 20;
}

.help-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--help-gap);
    border-bottom: 0.0625rem solid var(--help-border);
    min-height: var(--help-touch-min);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--help-header-glow) 0%, transparent 100%);
    position: relative;
}

.help-sidebar-title {
    font-size: var(--help-font-base);
    font-weight: 700;
    color: var(--help-text-strong);
}

.help-sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--help-touch-min);
    height: var(--help-touch-min);
    background: none;
    border: none;
    color: var(--help-dim);
    cursor: pointer;
    border-radius: var(--help-radius);
    transition: background var(--help-transition), color var(--help-transition);
}

.help-sidebar-close:hover {
    background: var(--help-surface-2);
    color: var(--help-text-strong);
}

/* Sidebar search */
.help-sidebar-search {
    padding: var(--help-gap-sm) var(--help-gap);
    flex-shrink: 0;
    position: relative;
}

.help-sidebar-search-wrap {
    position: relative;
}

.help-sidebar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--help-text-faint);
    pointer-events: none;
    width: 1rem;
    height: 1rem;
}

.help-sidebar-search-input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.25rem;
    background: var(--help-field);
    border: 0.0625rem solid var(--help-field-border);
    border-radius: var(--help-radius);
    color: var(--help-text-strong);
    font-size: var(--help-font-sm);
    outline: none;
    min-height: var(--help-touch-min);
    transition: border-color var(--help-transition), box-shadow var(--help-transition), background var(--help-transition);
}

.help-sidebar-search-input:focus {
    border-color: var(--help-accent);
    box-shadow: 0 0 0 0.1875rem var(--help-focus-glow), inset 0 0.0625rem 0.1875rem var(--help-focus-inset);
    background: var(--help-field-focus);
}

.help-sidebar-search-input::placeholder {
    color: var(--help-text-faint);
}

.dark .help-sidebar-search-input:focus {
    border-color: var(--help-accent);
}

/* Sidebar navigation scroll area */
.help-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--help-gap-sm) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--help-nav-thumb) transparent;
}

.help-sidebar-nav::-webkit-scrollbar {
    width: 0.375rem;
}

.help-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.help-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--help-nav-thumb);
    border-radius: var(--help-radius-xs);
}

.help-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--help-scrollbar-thumb-hover);
}

/* Sidebar footer */
.help-sidebar-footer {
    padding: var(--help-gap-sm) var(--help-gap);
    border-top: 0.0625rem solid var(--help-border);
    flex-shrink: 0;
}

.help-sidebar-back {
    display: flex;
    align-items: center;
    gap: var(--help-gap-sm);
    color: var(--help-text-muted);
    text-decoration: none;
    font-size: var(--help-font-sm);
    min-height: var(--help-touch-min);
    padding: 0 var(--help-gap-sm);
    border-radius: var(--help-radius);
    transition: color var(--help-transition), background var(--help-transition);
}

.help-sidebar-back:hover {
    color: var(--help-text-strong);
    background: var(--help-surface-2);
}

/* --------------------------------------------------------------------------
   3. Center Content (.help-content-area)
   -------------------------------------------------------------------------- */
.help-content-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Breadcrumb header bar */
.help-content-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: var(--help-gap) var(--help-gap-xl);
    border-bottom: 0.0625rem solid var(--help-border);
    font-size: var(--help-font-sm);
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: var(--help-touch-min);
}

.help-breadcrumb-link {
    color: var(--help-text-muted);
    text-decoration: none;
    transition: color var(--help-transition);
}

.help-breadcrumb-link:hover {
    color: var(--help-accent);
}

.dark .help-breadcrumb-link:hover {
    color: var(--help-accent);
}

.help-breadcrumb-sep {
    color: var(--help-line-strong);
    font-size: 0.625rem;
}

.help-breadcrumb-current {
    color: var(--help-text-strong);
    font-weight: 600;
}

/* Scrollable content body */
.help-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--help-gap-xl);
}

/* Previous / Next / Feedback footer bar */
.help-content-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--help-gap) var(--help-gap-xl);
    border-top: 0.0625rem solid var(--help-border);
    flex-shrink: 0;
    gap: var(--help-gap);
    flex-wrap: wrap;
}

.help-content-footer-nav {
    display: flex;
    gap: var(--help-gap-sm);
}

.help-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--help-surface-2);
    border: 0.0625rem solid var(--help-border);
    border-radius: var(--help-radius);
    color: var(--help-control-text);
    font-size: var(--help-font-sm);
    cursor: pointer;
    min-height: var(--help-touch-min);
    text-decoration: none;
    transition: background var(--help-transition), border-color var(--help-transition), color var(--help-transition);
}

.help-footer-btn:hover {
    background: var(--help-border);
    border-color: var(--help-line-strong);
    color: var(--help-text-strong);
}

.help-footer-feedback {
    display: flex;
    align-items: center;
    gap: var(--help-gap-sm);
    font-size: var(--help-font-sm);
    color: var(--help-text-muted);
}

.help-feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--help-touch-min);
    height: var(--help-touch-min);
    background: none;
    border: 0.0625rem solid var(--help-border);
    border-radius: var(--help-radius);
    color: var(--help-text-muted);
    cursor: pointer;
    transition: background var(--help-transition), color var(--help-transition), border-color var(--help-transition);
}

.help-feedback-btn:hover {
    background: var(--help-surface-2);
    color: var(--help-accent);
    border-color: var(--help-accent);
}

.dark .help-feedback-btn:hover {
    /* Kept: its .dark weight beats .help-feedback-btn.active below, so a
       selected button still shows the hover surface in dark. */
    background: var(--help-surface-2);
    color: var(--help-accent);
    border-color: var(--help-accent);
}

.help-feedback-btn.active {
    background: var(--help-accent-light);
    color: var(--help-accent);
    border-color: var(--help-accent);
}

/* --------------------------------------------------------------------------
   4. Right Sidebar / TOC (.help-sidebar-right)
   -------------------------------------------------------------------------- */
.help-sidebar-right {
    position: sticky;
    top: var(--help-header-h);
    height: calc(100vh - var(--help-header-h));
    width: 0;
    opacity: 0;
    overflow: hidden;
    background: var(--help-surface);
    border-left: 0.0625rem solid var(--help-border);
    transition: width var(--help-transition), opacity var(--help-transition);
    display: flex;
    flex-direction: column;
}

.toc-open .help-sidebar-right {
    width: var(--help-sidebar-right-w);
    opacity: 1;
}

.help-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--help-gap);
    border-bottom: 0.0625rem solid var(--help-border);
    min-height: var(--help-touch-min);
    flex-shrink: 0;
}

.help-toc-title {
    font-size: var(--help-font-sm);
    font-weight: 700;
    color: var(--help-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

.help-toc-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--help-touch-min);
    height: var(--help-touch-min);
    background: none;
    border: none;
    color: var(--help-dim);
    cursor: pointer;
    border-radius: var(--help-radius);
    transition: background var(--help-transition), color var(--help-transition);
}

.help-toc-close:hover {
    background: var(--help-surface-2);
    color: var(--help-text-strong);
}

.help-toc-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--help-gap-sm) var(--help-gap);
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: var(--help-field-border) transparent;
}

.help-toc-item {
    margin-bottom: 0.125rem;
}

.help-toc-item a {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    color: var(--help-text-muted);
    text-decoration: none;
    font-size: var(--help-font-sm);
    border-left: 0.125rem solid transparent;
    border-radius: 0 var(--help-radius) var(--help-radius) 0;
    min-height: var(--help-touch-min);
    transition: color var(--help-transition), border-color var(--help-transition), background var(--help-transition);
}

.help-toc-item a:hover {
    color: var(--help-text-strong);
    background: var(--help-surface-2);
}

.help-toc-item.active a {
    color: var(--help-accent-hover);
    border-left-color: var(--help-accent);
    background: var(--help-active-bg);
    font-weight: 600;
}

.dark .help-toc-item.active a {
    color: var(--help-accent);
    border-left-color: var(--help-accent);
    background: var(--help-accent-light);
}

.help-toc-item--h3 a {
    padding-left: 1.5rem;
    font-size: var(--help-font-xs);
}

/* --------------------------------------------------------------------------
   5. Tree Navigation
   -------------------------------------------------------------------------- */
.help-tree-category {
    margin: 0.25rem 0;
}

.help-tree-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.75rem var(--help-gap);
    background: none;
    border: none;
    border-left: 0.1875rem solid transparent;
    color: var(--help-control-text);
    font-size: var(--help-font-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: left;
    cursor: pointer;
    min-height: var(--help-touch-min);
    border-radius: 0;
    transition: color 0.2s ease, background 0.2s ease, border-left-color 0.2s ease;
}

.help-tree-toggle:hover {
    color: var(--help-text-strong);
    background: var(--help-surface-2);
    border-left-color: var(--help-accent);
}

.dark .help-tree-toggle:hover {
    border-left-color: var(--help-accent);
}

.help-tree-toggle.active {
    color: var(--help-accent-hover);
    border-left-color: var(--help-accent);
}

.dark .help-tree-toggle.active {
    color: var(--help-accent);
    border-left-color: var(--help-accent);
}

.help-tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    font-size: var(--help-font-sm);
    background: var(--help-icon-bg);
    border-radius: var(--help-radius-md);
    transition: background 0.2s ease, color 0.2s ease;
}

.help-tree-category.expanded .help-tree-icon {
    background: var(--help-icon-active-bg);
    color: var(--help-accent-hover);
}

.dark .help-tree-category.expanded .help-tree-icon {
    color: var(--help-accent);
}

.help-tree-toggle:hover .help-tree-icon {
    background: var(--help-icon-hover-bg);
}

.help-tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.help-tree-chevron {
    font-size: 0.625rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
    color: var(--help-text-faint);
}

.help-tree-category.expanded .help-tree-chevron {
    transform: rotate(90deg);
    color: var(--help-accent);
}

.dark .help-tree-category.expanded .help-tree-chevron {
    color: var(--help-accent);
}

.help-tree-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
    position: relative;
    margin-left: 1.875rem;
    border-left: 0.0625rem solid var(--help-border);
}

.help-tree-category.expanded .help-tree-children {
    /* Large cap (was 31.25rem): the fixed cap clipped and hid articles in
       categories with many topics. This is the higher-specificity rule that
       wins over help.html's inline style, so the cap is corrected here. The
       parent sidebar nav scrolls, so a generous cap keeps every item reachable. */
    max-height: 200rem;
    opacity: 1;
}

.help-tree-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem var(--help-gap) 0.5625rem 1.5rem;
    color: var(--help-text-muted);
    text-decoration: none;
    font-size: var(--help-font-sm);
    min-height: var(--help-touch-min);
    position: relative;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

/* Small dot indicator on children */
.help-tree-link::before {
    content: '';
    position: absolute;
    left: -0.21875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.375rem;
    height: 0.375rem;
    border-radius: var(--help-radius-round);
    background: transparent;
    transition: background 0.2s ease, transform 0.2s ease;
}

.help-tree-link:hover {
    color: var(--help-text-strong);
    background: var(--help-tree-hover);
    transform: translateX(0.125rem);
}

.help-tree-link:hover::before {
    background: var(--help-tree-marker-hover);
}

.dark .help-tree-link:hover {
    transform: translateX(0.125rem);
}

/* Active state: accent left border + background glow + dot */
.help-tree-link.active {
    color: var(--help-accent-hover);
    background: var(--help-active-bg);
    border-left: 0.1875rem solid var(--help-accent);
    padding-left: calc(1.5rem - 0.1875rem);
    font-weight: 500;
}

.help-tree-link.active::before {
    background: var(--help-accent);
    transform: translateY(-50%) scale(1.2);
}

.dark .help-tree-link.active {
    color: var(--help-accent);
    background: var(--help-accent-light);
    border-left-color: var(--help-accent);
}

.dark .help-tree-link.active::before {
    background: var(--help-accent);
    transform: translateY(-50%) scale(1.2);
}

/* --------------------------------------------------------------------------
   6. Article Typography (.help-article-content)
   -------------------------------------------------------------------------- */
.help-article-content h1 {
    font-size: var(--help-font-2xl);
    font-weight: 800;
    margin-bottom: var(--help-gap);
    color: var(--help-text-strong);
    line-height: 1.2;
}

.help-article-content h2 {
    font-size: var(--help-font-xl);
    font-weight: 700;
    margin-top: var(--help-gap-xl);
    margin-bottom: var(--help-gap);
    color: var(--help-text-strong);
    line-height: 1.3;
    padding-bottom: var(--help-gap-sm);
    border-bottom: 0.0625rem solid var(--help-border);
}

.help-article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: var(--help-gap-lg);
    margin-bottom: var(--help-gap-sm);
    color: var(--help-text-h3);
}

.help-article-content p {
    font-size: var(--help-font-base);
    line-height: 1.75;
    color: var(--help-text-soft);
    margin-bottom: var(--help-gap);
}

.help-article-content a {
    color: var(--help-accent-hover);
    text-decoration: none;
    transition: color var(--help-transition);
}

.help-article-content a:hover {
    color: var(--help-link-hover);
    text-decoration: underline;
}

.dark .help-article-content a {
    color: var(--help-accent);
}

/* Kept: the rule above ties .help-article-content a:hover and comes later,
   so the dark hover colour needs its own .dark rule (as before). */
.dark .help-article-content a:hover {
    color: var(--help-link-hover);
}

.help-article-content ul,
.help-article-content ol {
    padding-left: 1.5rem;
    margin-bottom: var(--help-gap);
}

.help-article-content li {
    font-size: var(--help-font-base);
    line-height: 1.75;
    color: var(--help-text-soft);
    margin-bottom: 0.25rem;
}

/* Inline code */
.help-article-content code {
    background: var(--help-surface-2);
    border: 0.0625rem solid var(--help-border);
    border-radius: var(--help-radius-sm);
    padding: 0.125rem 0.375rem;
    font-family: var(--help-font-mono);
    font-size: 0.85em;
    color: var(--help-accent-hover);
}

.dark .help-article-content code {
    background: var(--help-surface-2);
    border-color: var(--help-border);
    color: var(--help-accent);
}

/* Code blocks */
.help-article-content pre {
    background: var(--help-code-bg);
    border: 0.0625rem solid var(--help-code-border);
    border-radius: var(--help-radius);
    padding: var(--help-gap);
    margin-bottom: var(--help-gap);
    overflow-x: auto;
    font-family: var(--help-font-mono);
    font-size: var(--help-font-sm);
    line-height: 1.6;
    color: var(--help-code-text);
}

.help-article-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* Tables */
.help-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--help-gap);
    font-size: var(--help-font-sm);
}

.help-article-content th {
    background: var(--help-surface-2);
    border: 0.0625rem solid var(--help-border);
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--help-text-strong);
}

.help-article-content td {
    border: 0.0625rem solid var(--help-border);
    padding: 0.625rem 0.875rem;
    color: var(--help-text-soft);
}

.help-article-content tr:hover td {
    background: var(--help-surface);
}

/* Blockquote */
.help-article-content blockquote {
    border-left: 0.25rem solid var(--help-accent);
    padding: var(--help-gap) var(--help-gap-lg);
    margin: var(--help-gap) 0;
    background: var(--help-quote-bg);
    color: var(--help-text-soft);
    font-style: italic;
    border-radius: 0 var(--help-radius) var(--help-radius) 0;
}

/* Images */
.help-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--help-radius);
    margin: var(--help-gap) 0;
    border: 0.0625rem solid var(--help-border);
}

/* Callout boxes — base layout */
.callout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.callout > i {
    flex-shrink: 0;
    font-size: 1.125rem;
    margin-top: 0.125rem;
}

.callout ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.callout ul li {
    margin-bottom: 0.25rem;
}

.callout code {
    background: var(--help-callout-code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: var(--help-radius-sm);
    font-size: 0.8125rem;
    font-family: var(--help-font-callout-code);
}

.dark .callout code {
    background: var(--help-callout-code-bg);
}

/* Callout boxes — color variants */
.callout-info,
.callout-warning,
.callout-success,
.callout-danger,
.callout-tip {
    border-left: 0.25rem solid;
    border-radius: 0 var(--help-radius) var(--help-radius) 0;
    padding: var(--help-gap);
    margin: var(--help-gap) 0;
    font-size: var(--help-font-sm);
    line-height: 1.6;
}

.callout-info {
    border-color: var(--help-callout-info);
    background: var(--help-callout-info-bg);
    color: var(--help-callout-info-text);
}

.callout-warning {
    border-color: var(--help-callout-warning);
    background: var(--help-callout-warning-bg);
    color: var(--help-callout-warning-text);
}

.callout-success {
    border-color: var(--help-callout-success);
    background: var(--help-callout-success-bg);
    color: var(--help-callout-success-text);
}

.callout-danger {
    border-color: var(--help-callout-danger);
    background: var(--help-callout-danger-bg);
    color: var(--help-callout-danger-text);
}

.callout-tip {
    border-color: var(--help-callout-tip);
    background: var(--help-callout-tip-bg);
    color: var(--help-callout-tip-text);
}

.callout-tip > i {
    color: var(--help-callout-tip);
}

.callout-info > i {
    color: var(--help-callout-info);
}

.callout-warning > i {
    color: var(--help-callout-warning);
}

.callout-success > i {
    color: var(--help-callout-success);
}

.callout-danger > i {
    color: var(--help-callout-danger);
}

.callout-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* --------------------------------------------------------------------------
   7. Search Results (.help-search-results)
   -------------------------------------------------------------------------- */
.help-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--help-field);
    border: 0.0625rem solid var(--help-field-border);
    border-radius: 0 0 var(--help-radius) var(--help-radius);
    max-height: 18.75rem;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: 0 0.5rem 1.5rem var(--help-shadow);
}

.help-search-results.visible {
    display: block;
}

.help-search-results-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    color: var(--help-text-soft);
    text-decoration: none;
    font-size: var(--help-font-sm);
    min-height: var(--help-touch-min);
    transition: background var(--help-transition), color var(--help-transition);
}

.help-search-results-item:hover,
.help-search-results-item.focused {
    background: var(--help-hover);
    color: var(--help-text-strong);
}

.help-search-results-empty {
    padding: var(--help-gap);
    text-align: center;
    color: var(--help-text-faint);
    font-size: var(--help-font-sm);
}

.help-search-results-highlight {
    background: var(--help-highlight-bg);
    color: var(--help-accent-hover);
    border-radius: var(--help-radius-2xs);
    padding: 0 0.125rem;
}

.dark .help-search-results-highlight {
    color: var(--help-accent);
}

/* --------------------------------------------------------------------------
   8. Scrollbar (.help-scrollbar)
   -------------------------------------------------------------------------- */
.help-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--help-scrollbar-thumb) transparent;
}

.help-scrollbar::-webkit-scrollbar {
    width: 0.375rem;
}

.help-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.help-scrollbar::-webkit-scrollbar-thumb {
    background: var(--help-scrollbar-thumb);
    border-radius: var(--help-radius-xs);
    transition: background 0.2s ease;
}

.help-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--help-scrollbar-thumb-hover);
}

/* --------------------------------------------------------------------------
   Quick Links Grid (Home / Category Landing)
   -------------------------------------------------------------------------- */
.help-quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--help-gap);
    margin-top: var(--help-gap-lg);
}

.help-quick-card {
    background: var(--help-panel);
    border: 0.0625rem solid var(--help-border);
    border-radius: var(--help-radius-lg);
    padding: var(--help-gap-lg);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: var(--help-gap-sm);
    cursor: pointer;
    min-height: var(--help-touch-min);
    transition: border-color var(--help-transition), transform var(--help-transition), box-shadow var(--help-transition);
}

.help-quick-card:hover {
    border-color: var(--help-accent);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem var(--help-card-hover-shadow);
}

.dark .help-quick-card:hover {
    border-color: var(--help-accent);
}

.help-quick-card-icon {
    font-size: var(--help-font-xl);
    color: var(--help-accent);
}

.help-quick-card-title {
    font-size: var(--help-font-base);
    font-weight: 700;
    color: var(--help-text-strong);
}

.help-quick-card-desc {
    font-size: var(--help-font-sm);
    color: var(--help-text-muted);
    line-height: 1.5;
}

.help-quick-card-count {
    font-size: var(--help-font-xs);
    color: var(--help-text-faint);
    margin-top: auto;
}

/* --------------------------------------------------------------------------
   Step-by-Step Instructions
   -------------------------------------------------------------------------- */
.help-steps {
    counter-reset: help-step;
    list-style: none;
    padding: 0;
    margin: var(--help-gap) 0;
}

.help-steps-item {
    display: flex;
    align-items: flex-start;
    gap: var(--help-gap);
    margin-bottom: var(--help-gap);
    counter-increment: help-step;
    position: relative;
}

.help-steps-item::before {
    content: counter(help-step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--help-accent);
    color: var(--help-on-accent);
    border-radius: var(--help-radius-round);
    font-size: var(--help-font-sm);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.help-steps-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0.96875rem;
    top: 2.25rem;
    bottom: -0.5rem;
    width: 0.125rem;
    background: var(--help-border);
}

.help-steps-content {
    flex: 1;
    padding-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Keyboard Focus Styles
   -------------------------------------------------------------------------- */
.help-tree-toggle:focus-visible,
.help-tree-link:focus-visible,
.help-sidebar-search-input:focus-visible,
.help-sidebar-close:focus-visible,
.help-toc-close:focus-visible,
.help-footer-btn:focus-visible,
.help-feedback-btn:focus-visible,
.help-quick-card:focus-visible,
.help-mobile-toggle:focus-visible {
    outline: 0.125rem solid var(--help-accent);
    outline-offset: 0.125rem;
}

/* --------------------------------------------------------------------------
   Mobile Sidebar Overlay
   -------------------------------------------------------------------------- */
.help-sidebar-overlay {
    visibility: hidden;
    position: fixed;
    inset: 0;
    background: var(--help-overlay);
    z-index: 35;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.help-sidebar-overlay.visible {
    visibility: visible;
    opacity: 1;
}

/* Mobile header bar (hidden on desktop) */
.help-mobile-header {
    display: none;
    position: sticky;
    top: var(--help-header-h);
    z-index: 30;
    background: var(--help-panel);
    border-bottom: 0.0625rem solid var(--help-border);
    padding: 0 var(--help-gap);
    min-height: var(--help-touch-min);
    align-items: center;
    gap: var(--help-gap-sm);
}

.help-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--help-touch-min);
    height: var(--help-touch-min);
    background: none;
    border: none;
    color: var(--help-control-text);
    cursor: pointer;
    border-radius: var(--help-radius);
    transition: background var(--help-transition);
}

.help-mobile-toggle:hover {
    background: var(--help-surface-2);
}

.help-mobile-title {
    font-size: var(--help-font-base);
    font-weight: 700;
    color: var(--help-text-strong);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes helpFadeIn {
    from { opacity: 0; transform: translateY(0.5rem); }
    to   { opacity: 1; transform: translateY(0); }
}

.help-content-animate {
    animation: helpFadeIn 0.3s ease;
}

@keyframes helpPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.help-loading {
    animation: helpPulse 1.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Workflow diagrams (help-common-topics.js). SVG presentation attributes
   cannot read var(), and style= is barred by the strict CSP, so the shapes
   carry these classes instead of fill/stroke hexes. Unthemed they paint
   exactly the old #f97316 / #d1d5db in both themes.
   -------------------------------------------------------------------------- */
.help-svg-accent {
    fill: var(--help-accent);
    stroke: var(--help-accent);
}

.help-svg-line {
    stroke: var(--help-svg-line);
}

.help-svg-arrow {
    fill: var(--help-svg-line);
}

/* --------------------------------------------------------------------------
   9. Responsive - Tablet (max-width: 79.9375rem / 1279px)
   -------------------------------------------------------------------------- */
@media (max-width: 79.9375rem) {
    .help-layout {
        grid-template-columns: var(--help-sidebar-left-w) 1fr;
    }

    .help-layout.toc-open {
        grid-template-columns: var(--help-sidebar-left-w) 1fr;
    }

    /* Right sidebar becomes overlay on tablet */
    .help-sidebar-right {
        position: fixed;
        top: var(--help-header-h);
        right: 0;
        height: calc(100vh - var(--help-header-h));
        z-index: 40;
        box-shadow: -0.5rem 0 1.5rem var(--help-shadow);
    }

    .toc-open .help-sidebar-right {
        width: var(--help-sidebar-right-w);
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   9b. Responsive - Mobile (max-width: 47.9375rem / 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 47.9375rem) {
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-layout.toc-open {
        grid-template-columns: 1fr;
    }

    /* Left sidebar slides in from left */
    .help-sidebar-left {
        position: fixed;
        top: var(--help-header-h);
        left: 0;
        width: min(85vw, 20rem);
        height: calc(100vh - var(--help-header-h));
        z-index: 40;
        transform: translateX(-100%);
        transition: transform var(--help-transition);
        box-shadow: 0.5rem 0 1.5rem var(--help-shadow);
    }

    .help-sidebar-left.open {
        transform: translateX(0);
    }

    .help-sidebar-close {
        display: flex;
    }

    .help-mobile-header {
        display: flex;
    }

    .help-content-scroll {
        padding: var(--help-gap);
    }

    .help-content-header {
        padding: var(--help-gap);
    }

    .help-content-footer {
        padding: var(--help-gap);
        flex-direction: column;
        align-items: flex-start;
    }

    .help-quick-links {
        grid-template-columns: 1fr;
    }

    .help-article-content h1 {
        font-size: var(--help-font-xl);
    }

    .help-article-content h2 {
        font-size: var(--help-font-lg);
    }
}

/* --------------------------------------------------------------------------
   10. Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .help-sidebar-left,
    .help-sidebar-right,
    .help-sidebar-overlay,
    .help-mobile-header,
    .help-content-header,
    .help-content-footer,
    .help-sidebar-search {
        display: none !important;
    }

    .help-layout {
        display: block;
        background: white;
        color: black;
    }

    .help-content-scroll {
        padding: 0;
        overflow: visible;
    }

    .help-article-content h1,
    .help-article-content h2,
    .help-article-content h3 {
        color: black;
    }

    .help-article-content p,
    .help-article-content li,
    .help-article-content td {
        color: var(--help-print-text);
    }

    .help-article-content pre {
        border: 0.0625rem solid var(--help-print-border);
        background: var(--help-print-code-bg);
        color: var(--help-print-text);
    }

    .help-article-content table {
        border-collapse: collapse;
    }

    .help-article-content th {
        background: var(--help-print-th-bg);
        color: black;
    }

    .callout-info,
    .callout-warning,
    .callout-success,
    .callout-danger,
    .callout-tip {
        border-left-width: 0.1875rem;
    }

    .help-quick-card {
        break-inside: avoid;
        border: 0.0625rem solid var(--help-print-border);
    }
}
