/* Mendflow «Помощь» и вкладка «Обращения» в модерации (js/help.js). Токены из style.css */
.help-view { background: transparent; border: none; box-shadow: none; }
.help-view .help-wrap { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 860px; color: var(--ink); }
.help-view .hp-hero { padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: linear-gradient(135deg, var(--surface), var(--hover)); box-shadow: var(--shadow-soft); }
.help-view .hp-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.help-view .hp-title { margin: 6px 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; color: var(--ink); }
.help-view .hp-sub { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.help-view .hp-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-soft); align-self: flex-start; max-width: 100%; }
.help-view .hp-tab { min-height: 40px; padding: 8px 16px; border-radius: 999px; background: transparent; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.help-view .hp-tab:hover { color: var(--ink); background: var(--hover); }
.help-view .hp-tab.is-active { background: var(--accent); color: #fff; }
[data-theme="dark"] .help-view .hp-tab.is-active { color: #120e1d; }

.hp-chat { display: flex; flex-direction: column; gap: 10px; min-height: 160px; margin-bottom: 12px; }
.hp-chat--thread { min-height: 0; }
.hp-msg { align-self: flex-start; max-width: 88%; min-width: 0; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--ink); line-height: 1.5; }
.hp-msg--mine { align-self: flex-end; background: var(--tag-bg); }
.hp-msg-who { font-size: 12px; font-weight: 700; color: var(--ink-muted); margin-bottom: 4px; }
.hp-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.hp-typing { color: var(--ink-muted); }
.hp-article { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-muted); border: 1px solid var(--border); font-size: 14px; }
.hp-article summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.hp-article p { margin: 6px 0 0; line-height: 1.5; color: var(--ink); }
.hp-link { display: block; margin-top: 8px; padding: 4px 0; background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 14px; text-align: left; }
.hp-link:hover { text-decoration: underline; }
.hp-link:disabled { opacity: .5; }
.hp-empty { margin: 8px 0; color: var(--ink-muted); }
.hp-form { display: flex; gap: 8px; align-items: flex-end; }
.hp-input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.hp-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hp-form .hp-send { flex: 0 0 auto; width: auto; min-height: 44px; }
.hp-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-muted); line-height: 1.45; }

.hp-list { display: flex; flex-direction: column; gap: 8px; }
.hp-ticket { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 14px; text-align: left; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.hp-ticket:hover { border-color: var(--accent); }
.hp-ticket-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.hp-ticket-top time { margin-left: auto; font-weight: 500; color: var(--ink-muted); }
.hp-ticket-subj { overflow-wrap: anywhere; line-height: 1.4; }
.hp-ticket-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; font-weight: 700; }
.hp-new { color: var(--accent); }
.hp-prio { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: #b7791f; }
.hp-prio--urgent { background: #d9480f; }
.hp-adm-thread:not(:empty) { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.hp-adm-thread .hp-form { margin-top: 8px; }

@media (max-width: 768px) {
  .help-view .hp-hero { padding: 16px; border-radius: var(--radius-md); }
  .help-view .hp-sub { font-size: 14px; }
  .help-view .hp-tabs { align-self: stretch; }
  .help-view .hp-tab { flex: 1; padding: 8px 6px; font-size: 14px; }
  .hp-msg { max-width: 94%; }
  .hp-form { flex-direction: column; align-items: stretch; }
  .hp-input { flex: none; width: 100%; box-sizing: border-box; font-size: 16px; }
}

/* Новый вид «Помощи»: поле ввода закреплено внизу карточки, прокручивается только переписка. */
#helpView.panel { padding: 0 !important; border: 0; border-radius: 0 !important; background: transparent; box-shadow: none; }
#helpView .help-wrap { container-type: inline-size; gap: 20px; max-width: none; width: 100%; margin: 0; }
#helpView .hp-tabs { display: flex; gap: 8px; align-self: flex-start; padding: 0; border: 0; background: none; }
#helpView .hp-tab { min-height: 48px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14.5px; font-weight: 600; }
#helpView .hp-tab:hover { background: var(--hover); }
#helpView .hp-tab.is-active { background: var(--ink); color: var(--surface); }
#helpView .hp-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#helpView .hp-chat-card { display: flex; flex-direction: column; gap: 12px; height: clamp(420px, calc(100dvh - 350px), 760px); padding: 18px; border-radius: 24px; background: var(--surface); }
#helpView .hp-chat { flex: 1 1 0; min-height: 0; margin: 0; padding: 6px 4px; overflow-y: auto; overscroll-behavior: contain; }
#helpView .hp-chat--thread { flex: none; height: clamp(260px, calc(100dvh - 520px), 560px); padding: 16px; border-radius: 24px; background: var(--surface); }
#helpView .hp-msg { border: 0; border-radius: 18px; background: var(--surface-muted, #f4f2f8); }
#helpView .hp-msg--mine { background: var(--pv-lav); color: var(--pv-on-tone); }
#helpView .hp-form { flex: 0 0 auto; align-items: stretch; margin: 0; }
.hp-input { height: 76px; min-height: 76px; max-height: 76px; resize: none; overflow-y: auto; }
#helpView .hp-input { border: 0; border-radius: 18px; background: var(--surface-muted, #f4f2f8); }
#helpView .hp-form .hp-send { min-height: 76px; padding: 10px 26px; border: 0; border-radius: 18px; background: var(--ink); box-shadow: none; color: var(--surface); font-weight: 700; }
#helpView .hp-note { flex: 0 0 auto; margin: 0; }
#helpView .hp-ticket { border: 0; border-radius: 18px; background: var(--surface); }
#helpView .hp-ticket:hover { background: var(--hover); }
#helpView .hp-form[data-id], #helpView #hpReplyForm { margin-top: 12px; }
#helpView #hpBody > .hp-empty { padding: 44px 24px; border: 1.5px dashed var(--pv-dash); border-radius: 24px; background: var(--surface); text-align: center; }
@media (max-width: 768px) {
  #helpView .hp-chat-card { height: calc(100dvh - 430px); min-height: 340px; }
  #helpView .hp-form { flex-direction: row; }
  #helpView .hp-tabs { align-self: stretch; }
  #helpView .hp-tab { flex: 1 1 0; }
  #helpView .hp-form .hp-send { padding: 10px 14px; }
}

/* S6-A2: активные сессии */
.mf-sessions:empty{display:none}
.mf-session-list{list-style:none;margin:8px 0 12px;padding:0;display:flex;flex-direction:column;gap:8px}
.mf-session{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--line,#e5e7eb);border-radius:12px}
.mf-session strong{font-size:14px}
.mf-session-meta{display:block;font-size:12px;color:var(--ink-soft,#6b7280);margin-top:2px}
.mf-session-current{font-size:11px;font-weight:700;color:#047857;background:rgba(16,185,129,.12);border-radius:999px;padding:2px 8px;margin-left:6px}

/* S6-A5: кнопка «?» и подсказки по разделу */
.mf-help-fab{position:fixed;right:20px;bottom:20px;z-index:900;width:44px;height:44px;border-radius:50%;border:0;background:linear-gradient(135deg,#7c3aed,#6366f1);color:#fff;font-size:20px;font-weight:800;box-shadow:0 6px 20px rgba(99,102,241,.35);cursor:pointer}
.mf-help-fab:hover{filter:brightness(1.08)}
.mf-help-fab[hidden]{display:none}
@media (max-width:900px){.mf-help-fab{right:14px;width:40px;height:40px;font-size:18px}}
.hp-suggest{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}
.hp-suggest-title{width:100%;margin:0;font-size:13px;color:var(--ink-soft,#6b7280)}
.hp-suggest-item{border:1px solid rgba(124,58,237,.25);border-radius:999px;padding:6px 12px;background:var(--surface,#fff);color:#6d28d9;font-size:13px;cursor:pointer}
[data-theme="dark"] .hp-suggest-item{background:#1f1b2e;color:#c4b5fd}
