/*
 * Help center (/help), "Have an issue?" (/support) and the help assistant widget (also on the
 * dashboard). Builds on /assets/tokens.css. Monochrome; status colours only in notices.
 */

/* ------------------------------------------------------------------ help search (black page head) */
.help-search { display: flex; gap: var(--s-3); max-width: 640px; margin-top: var(--s-5); }
.help-search-field { position: relative; flex: 1 1 auto; min-width: 0; }
.help-search-field input { width: 100%; padding-left: 40px; }
.help-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
@media (max-width: 480px) {
  .help-search { flex-direction: column; }
  .help-search .btn { width: 100%; }
}
.help-live { max-width: 640px; margin-top: var(--s-4); }
.help-live[hidden] { display: none; }
.help-crumb { color: inherit; }

/* ------------------------------------------------------------------ article lists */
.help .help-group + .help-group,
.help .help-results + .help-group { margin-top: var(--s-7); }
.help .help-results { margin-bottom: var(--s-7); }
.help h2 { scroll-margin-top: calc(var(--header-h) + var(--s-4)); }
.help-list { list-style: none; margin: var(--s-4) 0 0; padding: 0; border-top: var(--hairline); }
.prose .help-list li { margin: 0; padding: 0; }
.help-item a {
  display: grid;
  gap: 4px;
  padding: var(--s-4) 0;
  border-bottom: var(--hairline);
  text-decoration: none;
  color: var(--ink);
}
.help-item a:hover .help-item-title { text-decoration: underline; text-underline-offset: 3px; }
.help-item-title { font-weight: 500; }
.help-item-summary { color: var(--ink-2); font-size: var(--fs-sm); }
.inverse .help-list { border-color: var(--rule); }
.inverse .help-item a { border-color: var(--rule); }
.help-more { margin-top: var(--s-7); }
.help-article article > :first-child { margin-top: 0; }

/* ------------------------------------------------------------------ /support steps */
.support-steps { display: grid; gap: var(--s-7); padding: var(--s-7) 0 var(--s-9); max-width: 820px; }
.support-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s-4); }
.support-step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
.support-step h2 { font-size: var(--fs-h3); margin: 2px 0 var(--s-2); }
.support-step > div > p { margin: 0 0 var(--s-4); color: var(--ink-2); }
@media (max-width: 560px) {
  .support-step { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
}
.support-results { margin-top: var(--s-3); }
.support-results:empty { display: none; }
.support-hint { margin: var(--s-3) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }

.issue-form { display: grid; gap: 0; max-width: 640px; }
.issue-form .field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); }
@media (max-width: 560px) { .issue-form .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.issue-form textarea { min-height: 160px; }
.issue-form .counter { justify-self: end; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); }
.issue-form .field-error { min-height: 0; color: var(--bad); font-size: var(--fs-sm); }
.issue-form .field-error:empty { display: none; }
.issue-form .actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-2); }
.issue-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.turnstile-slot { min-height: 0; margin: var(--s-2) 0 var(--s-3); }
.turnstile-slot:empty { margin: 0; }
.issue-done { max-width: 640px; }
.issue-done[hidden], .issue-form[hidden], .account-note[hidden] { display: none; }
.issue-done .ticket { font-family: var(--font-mono); font-weight: 500; overflow-wrap: anywhere; }
.account-note { margin-bottom: var(--s-4); }

/* ------------------------------------------------------------------ help assistant (widget) */
.lx-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r-panel);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.lx-chat[hidden] { display: none; }
.lx-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 12px 10px 16px;
  border-bottom: var(--hairline);
}
.lx-chat-title { margin: 0; font-size: var(--fs-sm); font-weight: 600; }
.lx-chat-log {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-4);
}
.lx-msg { max-width: 92%; padding: 10px 12px; border-radius: var(--r-panel); white-space: pre-wrap; overflow-wrap: anywhere; }
.lx-msg p { margin: 0; }
.lx-msg-bot { align-self: flex-start; background: var(--bg-2); }
.lx-msg-user { align-self: flex-end; background: var(--ink); color: var(--bg); }
.lx-msg-error { align-self: flex-start; border: 1px solid var(--bad); }
.lx-msg-meta { display: block; margin-top: 8px; font-size: var(--fs-xs); color: var(--ink-2); white-space: normal; }
.lx-msg-meta a { color: var(--ink); }
.lx-msg-busy { color: var(--ink-2); }
.lx-chat-check { padding: 0 var(--s-4); }
.lx-chat-check:empty { display: none; }
.lx-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: var(--hairline); }
.lx-chat-form textarea { min-height: 44px; max-height: 140px; resize: vertical; font-size: var(--fs-sm); }
.lx-chat-form .btn { align-self: end; }
.lx-chat-foot { margin: 0; padding: 0 var(--s-4) var(--s-3); font-size: var(--fs-xs); color: var(--ink-2); }
.lx-chat-foot a { color: var(--ink); }

/* floating launcher + panel (help pages, dashboard) */
.lx-launcher {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: 800;
  box-shadow: 0 2px 10px rgba(10, 10, 10, 0.18);
}
.lx-launcher[hidden] { display: none; }
.lx-float {
  position: fixed;
  right: var(--s-4);
  bottom: calc(var(--s-4) + 52px);
  z-index: 800;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  box-shadow: 0 8px 28px rgba(10, 10, 10, 0.22);
}
.lx-float .lx-chat-log { max-height: min(360px, calc(100vh - 360px)); }
@media (max-width: 480px) {
  .lx-float { right: 8px; left: 8px; width: auto; bottom: calc(var(--s-4) + 52px); }
}
@media (prefers-reduced-motion: no-preference) {
  .lx-float { animation: lx-pop var(--dur-2, 200ms) var(--ease) both; }
}
@keyframes lx-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.support-common { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--fs-sm); }
