/* Help Centre (/help/…): user guides generated by tools/build-help.mjs.
   Same brand as css/app.css (deep green #0E3B2E, gold #C99A3B). Text is kept to
   about 72 characters a line; screenshots use the full column; tables scroll inside
   their own box on phones. Prints cleanly (no navigation, search or side list). */

.help-wrap { max-width: var(--wrap); }

/* --- hero band with breadcrumbs and search --------------------------------------------- */
.help-hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; padding: 36px 0 32px; }
.help-hero.compact { padding: 22px 0 22px; }
.help-hero h1 { font-size: 40px; margin: 0 0 10px; max-width: 30ch; }
.help-hero.compact h1 { font-size: 32px; }
.help-hero .lead { font-size: 18px; color: rgba(255,255,255,.88); max-width: 62ch; margin: 0 0 18px; }
.help-hero .kicker { color: var(--gold); margin-bottom: 6px; }
.help-chnum { color: var(--gold); }
.help-crumbs ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; }
.help-crumbs li { color: rgba(255,255,255,.75); }
.help-crumbs li + li::before { content: "›"; margin: 0 8px; color: rgba(255,255,255,.5); }
.help-crumbs a { color: rgba(255,255,255,.92); }
.help-crumbs a:hover { color: var(--gold); }
.help-search { display: flex; gap: 8px; max-width: 640px; margin-top: 8px; }
.help-search input[type=search] { flex: 1 1 auto; min-width: 0; border-color: transparent; }
.help-search .btn-gold { flex: 0 0 auto; }

/* search results */
.help-results { max-width: 760px; margin-top: 12px; background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 14px 16px; }
.help-results .help-results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--secondary); margin-bottom: 6px; }
.help-hits { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.help-hits li { border-top: 1px solid var(--border); padding: 10px 0; }
.help-hits li:first-child { border-top: 0; }
.help-hits a { display: block; color: var(--ink); }
.help-hits a:hover { text-decoration: none; }
.help-hits a:hover strong { color: var(--brand); text-decoration: underline; }
.help-hits .hit-meta { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.help-hits .hit-x { margin: 4px 0 0; font-size: 14px; color: var(--secondary); overflow-wrap: anywhere; }
.help-hits mark { background: var(--gold-soft); color: inherit; padding: 0 1px; border-radius: 3px; }
.help-results .btn-sm { margin-top: 8px; }

/* --- layout: sticky step list + article ---------------------------------------------------- */
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 44px; padding-top: 32px; padding-bottom: 64px; align-items: start; }
.help-layout.no-toc { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }
.help-aside { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.help-toc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.help-toc ol, .help-toc-mobile ol { list-style: none; margin: 0; padding: 0; }
.help-toc a, .help-toc-mobile a { display: block; padding: 5px 8px 5px 10px; border-left: 3px solid transparent; font-size: 14px; line-height: 1.35; color: var(--secondary); border-radius: 0 6px 6px 0; }
.help-toc a:hover, .help-toc-mobile a:hover { background: var(--bg-2); color: var(--brand); text-decoration: none; }
.help-toc a[aria-current="true"] { border-left-color: var(--gold); color: var(--brand); background: #fff; font-weight: 600; }
.toc-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .92em; margin-right: 2px; }
.help-toc-mobile { display: none; }
.help-article { min-width: 0; max-width: 980px; }
.help-meta { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.help-summary { font-size: 19px; color: var(--secondary); max-width: 64ch; }

/* --- prose -------------------------------------------------------------------------------- */
.help-prose { font-size: 17px; line-height: 1.7; }
.help-prose > p, .help-prose > ul, .help-prose > ol, .help-prose > h2, .help-prose > h3, .help-prose > h4, .help-prose > .help-note, .help-prose-p { max-width: 72ch; }
.help-prose ul, .help-prose ol { padding-left: 1.4em; }
.help-prose li { margin: .3em 0; }
.help-prose h2.help-sub { font-size: 24px; margin: 1.4em 0 .5em; scroll-margin-top: 84px; }
.help-prose h3.help-sub { font-size: 19px; margin: 1.3em 0 .4em; font-family: 'Space Grotesk', system-ui, sans-serif; scroll-margin-top: 84px; }
.help-intro > :first-child { margin-top: 0; }
.help-note { background: #E8F0EC; border-left: 4px solid var(--brand); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 0 0 1.1em; }
.help-note p { margin: 0; font-size: 16px; }
.help-table { margin: 0 0 1.3em; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.help-table table.data { font-size: 14.5px; line-height: 1.5; }
.help-table table.data th { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--secondary); }
.help-table table.data tr:last-child td { border-bottom: 0; }
.help-roles th[scope=row] { width: 30%; font-size: 14.5px; text-transform: none; letter-spacing: 0; color: var(--ink); background: none; font-weight: 600; }
.help-roles td { line-height: 1.7; }
.help-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- steps ---------------------------------------------------------------------------------- */
.help-step { border-top: 1px solid var(--border-strong); margin-top: 36px; padding-top: 30px; scroll-margin-top: 72px; }
.help-step h2 { font-size: 25px; display: flex; gap: 12px; align-items: baseline; margin-bottom: 16px; }
.step-num { flex: 0 0 auto; background: var(--brand); color: #fff; font-size: 15px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 700; border-radius: 6px; padding: 3px 9px; position: relative; top: -3px; font-variant-numeric: tabular-nums; }
.help-fig { margin: 0 0 20px; text-align: center; }
.help-zoom { display: inline-block; max-width: 100%; cursor: zoom-in; border-radius: 10px; }
.help-zoom img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.help-zoom:hover img { border-color: var(--gold); }
.help-fig figcaption { font-size: 14px; color: var(--secondary); margin-top: 10px; }
.help-label { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); font-weight: 700; margin: 18px 0 6px; font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.help-prose > .help-label:first-child { margin-top: 0; }
.help-label + p { margin-bottom: .6em; }
ol.help-do { list-style: none; counter-reset: do; padding-left: 0; }
ol.help-do > li { counter-increment: do; position: relative; padding-left: 38px; margin: .55em 0; }
ol.help-do > li::before { content: counter(do); position: absolute; left: 0; top: .2em; width: 26px; height: 26px; border-radius: 50%; background: #E3EEE8; color: var(--brand); font-size: 14px; font-weight: 700; line-height: 26px; text-align: center; }
.help-top { text-align: right; font-size: 14px; margin: 8px 0 0; }

.help-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; }
.help-pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--card); font-weight: 600; }
.help-pager a:hover { border-color: var(--brand); text-decoration: none; }
.help-pager-next { text-align: right; grid-column: 2; }

/* --- guide home, landing ---------------------------------------------------------------- */
.help-home { padding-top: 32px; padding-bottom: 64px; }
.help-home-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.help-quick h2 { font-size: 18px; }
.help-quick ul { list-style: none; margin: 0; padding: 0; }
.help-quick li { padding: 5px 0; border-top: 1px solid var(--border); font-size: 15px; }
.help-quick li:first-child { border-top: 0; }
.help-section { margin-top: 44px; scroll-margin-top: 80px; }
.help-section > h2 { font-size: 28px; }
.help-contents { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.help-ch { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; scroll-margin-top: 80px; }
.help-ch h3 { font-size: 20px; margin-bottom: 6px; font-family: 'Space Grotesk', system-ui, sans-serif; }
.help-ch > p { color: var(--secondary); max-width: 80ch; margin-bottom: 8px; }
.help-steps-list summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--brand); }
.help-steplist { list-style: none; margin: 8px 0 0; padding: 0; columns: 2 300px; column-gap: 28px; font-size: 14.5px; }
.help-steplist li { break-inside: avoid; padding: 3px 0; }
.help-extras { columns: 2 260px; }
.help-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.help-card { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.help-card .btn-row { margin-top: auto; }
.help-card-head { display: flex; gap: 14px; align-items: center; }
.help-card-head h2 { font-size: 24px; margin: 0; }
.help-card-head p { margin: 2px 0 0; }
.help-card-stats { margin: 0; }
.help-card .help-label { margin: 4px 0 0; }
.help-covered { margin: 0; padding-left: 1.2em; columns: 2 200px; column-gap: 20px; font-size: 15px; }
.help-covered li { break-inside: avoid; margin: 2px 0; }
.help-card.soon { background: #FBFBF7; box-shadow: none; border-style: dashed; }
.help-card.soon .help-card-head h2 { color: var(--secondary); }
.app-dot.app-audit { background: #0A6B34; }
.app-dot.app-sqm { background: #B23A3A; }
.app-dot.app-books { background: #8A5A00; }
.app-dot.app-payroll { background: #0E3B2E; }
.help-example { background: var(--gold-soft); border-radius: var(--radius); padding: 24px 26px; }
.help-example h2 { font-size: 24px; }
.help-example .help-prose p:last-child { margin-bottom: 0; }
.help-support { border-top: 1px solid var(--border); padding-top: 32px; }

/* FAQ and glossary */
.help-expand { margin: 0 0 12px; }
.help-faq { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin: 0 0 10px; scroll-margin-top: 80px; }
.help-faq summary { cursor: pointer; padding: 14px 44px 14px 18px; font-weight: 600; list-style: none; position: relative; }
.help-faq summary::-webkit-details-marker { display: none; }
.help-faq summary::after { content: "+"; position: absolute; right: 18px; top: 10px; font-size: 22px; color: var(--gold); font-weight: 700; }
.help-faq[open] summary::after { content: "–"; }
.help-faq > .help-prose { padding: 0 18px 6px; }
.help-more { margin-top: 24px; }
.help-glossary { margin: 0; }
.help-term { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 80px; }
.help-term dt { font-weight: 700; color: var(--brand); }
.help-term dd { margin: 0; max-width: 72ch; }
.help-term:target, .help-faq:target { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 8px; }

/* --- lightbox (js/pages/help.js) ---------------------------------------------------------- */
dialog.help-lightbox { border: 0; padding: 0; background: rgba(8, 20, 15, .92); max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; }
dialog.help-lightbox::backdrop { background: rgba(8, 20, 15, .88); }
.help-lightbox-inner { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 16px 16px; overflow: auto; }
.help-lightbox img { max-width: min(100%, 1600px); max-height: calc(100vh - 110px); width: auto; height: auto; background: #fff; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.4); cursor: zoom-out; }
.help-lightbox p { color: #fff; margin: 0; font-size: 15px; text-align: center; max-width: 90ch; }
.help-lightbox-close { position: fixed; top: 12px; right: 12px; background: #fff; color: var(--brand); border: 0; border-radius: 999px; min-width: 44px; min-height: 44px; font: 700 15px/1 'IBM Plex Sans', system-ui, sans-serif; padding: 0 16px; cursor: pointer; }

/* --- responsive ------------------------------------------------------------------------------ */
@media (max-width: 980px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .help-aside { display: none; }
  .help-toc-mobile { display: block; background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; margin: 0 0 20px; }
  .help-toc-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--brand); }
  .help-toc-mobile nav { max-height: 60vh; overflow-y: auto; padding: 0 8px 10px; border-top: 1px solid var(--border); }
  .help-home-top { grid-template-columns: minmax(0, 1fr); }
  .help-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .help-hero, .help-hero.compact { padding: 20px 0 20px; }
  .help-hero h1, .help-hero.compact h1 { font-size: 26px; }
  .help-hero .lead { font-size: 16px; }
  .help-prose { font-size: 16px; }
  .help-step { margin-top: 28px; padding-top: 22px; }
  .help-step h2 { font-size: 21px; gap: 10px; }
  .step-num { font-size: 13px; top: -2px; }
  .help-section > h2 { font-size: 24px; }
  .help-pager { grid-template-columns: minmax(0, 1fr); }
  .help-pager-next { grid-column: 1; }
  .help-term { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .help-example { padding: 18px 16px; }
  .help-ch { padding: 16px; }
  .help-search .btn-gold { padding: 10px 14px; }
  .help-table table.cols-3 { min-width: 540px; }
  .help-table table.cols-4, .help-table table.cols-5 { min-width: 660px; }
  .help-table table.help-roles { min-width: 0; }
}

/* --- print: one clean chapter ----------------------------------------------------------- */
@media print {
  .help-search, .help-results, .help-aside, .help-toc-mobile, .help-pager, .help-top, .help-crumbs, .help-expand, dialog.help-lightbox { display: none !important; }
  body.help-body { font-size: 11pt; }
  .help-hero, .help-hero.compact { background: none; color: #000; padding: 0 0 8pt; border-bottom: 2pt solid var(--brand); }
  .help-hero h1 { color: var(--brand); font-size: 22pt; }
  .help-hero .lead { color: #333; }
  .help-layout, .help-layout.no-toc { display: block; padding: 0; max-width: none; }
  .site-wrap { padding: 0; max-width: none; }
  .help-article { max-width: none; }
  .help-prose { font-size: 11pt; line-height: 1.5; }
  .help-step { break-before: auto; margin-top: 14pt; padding-top: 10pt; }
  .help-step h2, .help-label, .help-sub { break-after: avoid; }
  .help-fig { break-inside: avoid; }
  .help-zoom img { box-shadow: none; max-height: 12cm; width: auto; }
  .help-table { break-inside: auto; border-color: #bbb; }
  .help-table tr { break-inside: avoid; }
  .help-note, .help-faq, .help-ch { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  ol.help-do > li::before { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .step-num { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .help-steps-list > summary { display: none; }
}
