/* Справка «?» по разделу (слово владельца 10.11.2026): значок у заголовка страницы
   (с 23.11.2026 — из шапки убран) и панель справа, как окно ИИ-помощника
   (static/css/help-ai.css). Разметка — templates/_help_panel.html, статья —
   apps/support/templates/support/help/, поведение — static/js/help-panel.js.
   Подключается в base.html и base_mobile.html. */

/* Свои имена цветов: компьютер берёт токены tokens.css, телефон — tokens-mobile.css. */
:root {
  --hp-accent: var(--accent, #1d827b); --hp-accent-soft: var(--accent-soft, #e9f5f3);
  --hp-accent-line: var(--accent-line, #c4e3df); --hp-bg-card: var(--bg-card, #fff);
  --hp-bg-alt: var(--bg-alt, #f4f5f7); --hp-bg-subtle: var(--bg-subtle, #f8f9fb);
  --hp-border: var(--border, #e5e7eb); --hp-border-strong: var(--border-strong, #d1d5db);
  --hp-ink: var(--ink, #0a0e1a); --hp-ink-soft: var(--ink-soft, #3a3f4d); --hp-mute: var(--mute, #6b7280);
  --hp-warn: var(--warn, #b45309); --hp-warn-soft: var(--warn-soft, #fef3c7);
  --hp-info: var(--info, #1d4ed8); --hp-info-soft: var(--info-soft, #dbeafe);
  --hp-second: var(--secondary, #a86a2a);
  /* Пометки на снимках — отдельный оранжевый: бирюзу сайта на снимке не отличить от пометки. */
  --hp-mark: #e8590c;
}
body.m-page {
  --hp-accent: var(--m-primary, #1d827b); --hp-accent-soft: var(--m-primary-soft, #e9f5f3);
  --hp-accent-line: var(--m-primary-line, #c4e3df); --hp-bg-card: var(--m-bg-card, #fff);
  --hp-bg-alt: var(--m-bg-alt, #f4f5f7); --hp-border: var(--m-border, #e5e7eb);
  --hp-ink: var(--m-ink, #0a0e1a); --hp-mute: var(--m-mute, #6b7280);
}

/* ── Значок «?» сразу за заголовком страницы (слово владельца 23.11.2026) ──
   Из шапки он убран: на телефоне теснил корзину и «ИИ», а промах по нему открывал
   справку вместо меню. Значок вставляет static/js/help-panel.js в <h1> названия
   раздела — на компьютере и на телефоне одним и тем же кодом. Он НАРОЧНО мелкий
   (18 px, на телефоне 20 px): цель меньше пальца, случайно не нажать. */
.help-inline {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 18px; height: 18px; margin-left: 8px; padding: 0;
  vertical-align: 0.12em; border-radius: 50%;
  border: 1px solid var(--hp-border-strong, #d1d5db); background: transparent;
  color: var(--hp-mute, #6b7280); font: 700 11px/1 var(--font-sans, inherit); cursor: pointer;
}
.help-inline:hover { border-color: var(--hp-accent-line, #c4e3df); color: var(--hp-accent, #1d827b); }
.help-inline:focus-visible { outline: 2px solid var(--hp-accent-line, #c4e3df); outline-offset: 1px; }
.help-inline[aria-pressed="true"] { background: var(--hp-accent-soft, #e9f5f3); border-color: var(--hp-accent-line, #c4e3df); color: var(--hp-accent, #1d827b); }
body.m-page .help-inline { width: 20px; height: 20px; font-size: 11.5px; }
/* Страница без заголовка в теле (хабы «Бренды», «Сотрудники», CRM, «Бухгалтерия»):
   значок стоит своей строкой в правом верхнем углу содержимого. */
.help-row { display: flex; justify-content: flex-end; margin: 0 0 4px; }

/* ── Панель ── */
.hp { display: none; }
html.help-open .hp {
  display: flex; flex-direction: column; position: fixed; z-index: 1200;
  top: var(--tb-h, 40px); right: 0; bottom: 0; width: 600px; max-width: 100vw;
  background: var(--hp-bg-card); border-left: 1px solid var(--hp-border);
  box-shadow: -8px 0 24px rgba(10, 14, 26, 0.12); color: var(--hp-ink); font-size: 14px;
}
html.help-open body.m-page .hp { top: 0; width: 100vw; border-left: 0; box-shadow: none; font-size: 15px; }
body.m-page .hp__badge, body.m-page .hp__wide { display: none; }
.hp__head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--hp-border); }
.hp__q {
  width: 22px; height: 22px; border-radius: 50%; background: var(--hp-accent); color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
}
.hp__t { font-size: 14px; }
.hp__badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--hp-accent); background: var(--hp-accent-soft); border-radius: 4px; padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.hp__badge:empty { display: none; }
.hp__toc-btn, .hp__back {
  border: 1px solid var(--hp-border); background: var(--hp-bg-card); color: var(--hp-ink);
  border-radius: 6px; height: 26px; padding: 0 8px; font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.hp__toc-btn { margin-left: auto; }
.hp__toc-btn[aria-expanded="true"], .hp__back { background: var(--hp-accent-soft); border-color: var(--hp-accent-line); color: var(--hp-accent); }
.hp__ico { border: 0; background: none; color: var(--hp-mute); font-size: 14px; cursor: pointer; text-decoration: none; padding: 2px 4px; }
.hp__ico:hover { color: var(--hp-ink); }
.hp__where {
  font-size: 11.5px; color: var(--hp-mute); padding: 6px 16px; background: var(--hp-bg-alt);
  border-bottom: 1px solid var(--hp-border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp__where:empty { display: none; }
.hp__toc-pop {
  position: absolute; top: 46px; right: 12px; z-index: 3; width: 300px; max-width: calc(100% - 24px);
  max-height: 60vh; overflow: auto; background: var(--hp-bg-card); border: 1px solid var(--hp-border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 14, 26, 0.18); padding: 8px;
}
.hp__toc-pop a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--hp-ink); text-decoration: none; font-size: 13px; }
.hp__toc-pop a.is-sub { padding-left: 24px; color: var(--hp-ink-soft); font-size: 12.5px; }
.hp__toc-pop a:hover { background: var(--hp-bg-alt); }
.hp__toc-pop a.is-cur { background: var(--hp-accent-soft); color: var(--hp-accent); font-weight: 600; }
.hp__return {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
  border: 0; background: var(--hp-ink); color: #fff; border-radius: 18px; padding: 8px 14px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(10, 14, 26, 0.3);
}
.hp__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px 48px; line-height: 1.6; overscroll-behavior: contain; }
body.m-page .hp__scroll { padding: 12px 16px 48px; }
.hp-loading { color: var(--hp-mute); }
.hp__toc-pop[hidden], .hp__return[hidden], .hp-fnpop[hidden], .hp__back[hidden], .hp-zoom[hidden] { display: none !important; }

/* ── Справка на всю страницу (⤢) ── */
.hp-page { display: flex; justify-content: center; padding: 16px 16px 60px; background: var(--hp-bg-card); }
.hp-page .hp-page__col { overflow: visible; max-width: 820px; width: 100%; padding: 8px 0 40px; position: relative; }

/* ── Статья ── */
.hp-art h1, .hp-h1 { font-size: 21px; line-height: 1.3; margin: 2px 0 10px; }
.hp-art h2 { font-size: 17px; margin: 30px 0 8px; display: flex; gap: 8px; align-items: baseline; scroll-margin-top: 8px; }
.hp-art h3 { font-size: 15px; margin: 22px 0 6px; display: flex; gap: 8px; align-items: baseline; scroll-margin-top: 8px; }
.hp-art p, .hp-art ul, .hp-art ol { margin: 0 0 10px; }
.hp-art a { color: var(--hp-accent); }
.hp-art table { border-collapse: collapse; }
.hp-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 6px; background: var(--hp-accent-soft); color: var(--hp-accent); font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.hp-art h2.is-flash, .hp-art h3.is-flash { animation: hpFlash 1.2s ease-out; }
@keyframes hpFlash { 0% { background: var(--hp-accent-soft); } 100% { background: transparent; } }
.hp-crumb { font-size: 12px; color: var(--hp-mute); margin: 0 0 4px !important; }
.hp-brief { border: 1px solid var(--hp-accent-line); background: var(--hp-accent-soft); border-radius: 10px; padding: 10px 14px 4px; margin: 4px 0 14px; }
.hp-brief__h { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--hp-accent); }
.hp-brief ol, .hp-brief ul { margin: 6px 0; padding-left: 20px; }
.hp-toc { border: 1px solid var(--hp-border); border-radius: 10px; padding: 10px 14px; background: var(--hp-bg-subtle); margin: 0 0 8px; }
.hp-toc__h { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--hp-mute); }
.hp-toc ol { list-style: none; margin: 6px 0 0; padding: 0; }
.hp-toc__i a { display: flex; gap: 8px; padding: 2px 0; text-decoration: none; }
.hp-toc__i a:hover { text-decoration: underline; }
.hp-toc__i.is-sub a { padding-left: 22px; font-size: 13.5px; }
.hp-toc__n { min-width: 22px; color: var(--hp-mute); font-variant-numeric: tabular-nums; }
.hp-fn {
  display: inline-block; vertical-align: super; font-size: 10.5px; line-height: 1; font-weight: 700; text-decoration: none;
  color: var(--hp-accent); background: var(--hp-accent-soft); border-radius: 4px; padding: 2px 4px; margin-left: 2px;
}
.hp-fn:hover { background: var(--hp-accent); color: #fff; }
.hp-fnpop {
  position: absolute; z-index: 4; width: 320px; max-width: calc(100% - 16px); background: var(--hp-bg-card);
  border: 1px solid var(--hp-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 14, 26, 0.2);
  padding: 10px 12px; font-size: 13px; line-height: 1.5;
}
.hp-fnpop b { color: var(--hp-accent); }
.hp-fnpop a { color: var(--hp-accent); }
.hp-note { border-left: 3px solid var(--hp-warn); background: var(--hp-warn-soft); border-radius: 0 8px 8px 0; padding: 8px 12px; margin: 10px 0 12px; font-size: 13.5px; }
.hp-note p:last-child { margin-bottom: 0; }
.hp-note--tip { border-left-color: var(--hp-info); background: var(--hp-info-soft); }

/* снимки с пометками */
.hp-grp { margin: 10px 0 14px; }
.hp-grp--narrow { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
body.m-page .hp-grp--narrow { grid-template-columns: 1fr; }
body.m-page .hp-grp--narrow .hp-shot { max-width: 230px; }
.hp-shot { margin: 0 0 8px; padding-top: 8px; max-width: var(--w, 100%); }
.hp-shot__in { position: relative; border: 1px solid var(--hp-border); border-radius: 8px; cursor: zoom-in; background: var(--cb-ffffff, #fff); }
.hp-shot__in img { display: block; width: 100%; height: auto; border-radius: 8px; }
.hp-mk { position: absolute; border: 2px solid var(--hp-mark); border-radius: 6px; pointer-events: none; transition: background .15s, box-shadow .15s; }
.hp-mk i {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--hp-mark);
  color: #fff; font: 700 11px/18px var(--font-sans, inherit); font-style: normal; text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.hp-mk.is-hl { background: rgba(232, 89, 12, 0.14); box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.35); }
.hp-shot figcaption { font-size: 11.5px; color: var(--hp-mute); margin-top: 4px; }
.hp-legend { list-style: none; padding: 0; counter-reset: lg; }
.hp-legend li { counter-increment: lg; position: relative; padding: 4px 6px 4px 30px; border-radius: 6px; }
.hp-legend li::before {
  content: counter(lg); position: absolute; left: 4px; top: 6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--hp-mark); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.hp-legend li:hover { background: var(--hp-bg-alt); }
.hp-zoom { position: fixed; inset: 0; z-index: 1300; background: rgba(10, 14, 26, 0.75); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.hp-zoom .hp-shot__in { max-width: min(1300px, 95vw); cursor: zoom-out; }
.hp-zoom .hp-shot__in img { max-height: 88vh; width: auto; max-width: 100%; }

/* примеры */
.hp-ex { border: 1px dashed var(--hp-border-strong); border-radius: 10px; padding: 10px 12px; margin: 10px 0 14px; overflow-x: auto; }
.hp-ex__h { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--hp-second); margin-bottom: 6px; }
.hp-ex table { width: 100%; font-size: 13px; }
.hp-ex th { text-align: left; font-weight: 600; color: var(--hp-mute); font-size: 12px; border-bottom: 1px solid var(--hp-border); padding: 4px 6px; }
.hp-ex td { border-bottom: 1px solid var(--hp-border); padding: 5px 6px; vertical-align: top; }
.hp-ex tr:last-child td { border-bottom: 0; }
.hp-ex p:last-child { margin-bottom: 0; }
.hp-fns { margin-top: 28px; border-top: 1px solid var(--hp-border); padding-top: 4px; font-size: 13px; color: var(--hp-ink-soft); }
.hp-fns__h { font-size: 14px !important; color: var(--hp-mute); }
.hp-fns li { margin-bottom: 6px; scroll-margin-top: 8px; }
.hp-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: var(--hp-bg-alt); font-size: 13px; }
.hp-foot a { font-weight: 600; text-decoration: none; }
.hp-foot__ai { margin-left: auto; }
.hp-all { padding-left: 18px; }
.hp-all li { margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { .hp-art h2.is-flash, .hp-art h3.is-flash { animation: none; } }
