/* ADR 0036 — Help & support. Prefixes: help- (help centre + assistant + widget), tkt- (tickets),
   svy- (surveys). Scoped so nothing here leaks onto other pages. */

/* ── Help centre ─────────────────────────────────────────────────────────── */
.help-wrap { --help-line: var(--bs-border-color); }
.help-search { display: flex; gap: .5rem; margin: 0 auto 1.5rem; max-width: 34rem; }
.help-search input { flex: 1; }

.help-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .75rem; margin-bottom: 2rem; }
.help-tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; border: 1px solid var(--help-line); border-radius: 12px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.help-tile:hover { border-color: var(--mx-teal, #0c7a62); transform: translateY(-2px); }
.help-tile-label { font-weight: 600; }
.help-tile-count { font-size: .82rem; opacity: .7; }

.help-subhead { font-size: 1.05rem; margin: 1.25rem 0 .6rem; }
.help-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.help-list-item { padding: .55rem 0; border-bottom: 1px solid var(--help-line); }
.help-list-item a { text-decoration: none; }
.help-list-title { font-weight: 600; display: block; }
.help-list-summary { font-size: .85rem; opacity: .72; display: block; }
.help-empty, .help-reviewed, .help-faq-link { opacity: .7; font-size: .9rem; }
.help-empty-home { margin: 1.25rem 0; padding: 1rem 1.2rem; border: 1px solid var(--bs-border-color); border-radius: 12px; background: var(--bs-card-bg); }
.help-empty-home p { margin: 0; line-height: 1.6; }

.help-article .mx-longform { margin: 1rem 0; }
.help-related { margin-top: 1.5rem; }
.help-stuck { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--help-line); }
.help-stuck-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .75rem; }

.help-feedback { display: flex; align-items: center; gap: .5rem; margin: 1.25rem 0; font-size: .9rem; }
.help-feedback-btn { border: 1px solid var(--help-line); background: transparent; border-radius: 999px; padding: .15rem .8rem; cursor: pointer; color: inherit; }
.help-feedback-btn:hover { border-color: var(--mx-teal, #0c7a62); }
.help-feedback-thanks { opacity: .75; }

/* ── Help assistant ──────────────────────────────────────────────────────── */
.help-assistant { border: 1px solid var(--help-line, #e2e8de); border-radius: 12px; padding: 1rem; margin-top: .75rem; }
.help-asst-thread { display: flex; flex-direction: column; gap: 1rem; margin-bottom: .75rem; }
.help-asst-turn { display: flex; flex-direction: column; gap: .4rem; }
.help-asst-q { font-weight: 600; }
.help-asst-a { line-height: 1.55; }
.help-asst-ungrounded, .help-asst-fallback { opacity: .8; }
.help-asst-cites { display: flex; flex-wrap: wrap; gap: .4rem; }
.help-asst-cite { font-size: .8rem; text-decoration: none; border: 1px solid var(--help-line); border-radius: 999px; padding: .1rem .6rem; }
.help-asst-kind { color: var(--bs-secondary-color); margin-right: .25rem; }
.help-asst-ticket { display: inline-block; font-weight: 600; margin-top: .25rem; }
.help-asst-followups { display: flex; flex-wrap: wrap; gap: .4rem; }
.help-asst-followup { border: 1px dashed var(--help-line); background: transparent; border-radius: 999px; padding: .15rem .7rem; font-size: .82rem; cursor: pointer; color: inherit; }
.help-asst-form { display: flex; gap: .5rem; }
.help-asst-form input { flex: 1; }
/* Muted ink, not opacity: opacity .6 put this metadata near 3:1. */
.help-asst-foot { font-size: .78rem; color: var(--bs-secondary-color); margin-top: .5rem; }

/* ── Help widget (floating) ──────────────────────────────────────────────── */
.help-widget { position: fixed; right: 1.1rem; bottom: 5.4rem; z-index: 1040; }
.help-widget-btn { list-style: none; width: 3rem; height: 3rem; border-radius: 50%; background: var(--mx-teal, #0c7a62); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.help-widget-btn::-webkit-details-marker { display: none; }
.help-widget-panel { position: absolute; right: 0; bottom: 3.6rem; width: 15rem; background: var(--mx-nav-card); border: 1px solid var(--help-line, #e2e8de); border-radius: 12px; padding: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.16); display: flex; flex-direction: column; gap: .4rem; }
.help-widget-title { font-weight: 600; margin-bottom: .2rem; }
.help-widget-link { text-decoration: none; padding: .3rem .1rem; border-radius: 6px; }
.help-widget-link:hover { color: var(--mx-teal, #0c7a62); }
/* The WhatsApp link inside the menu is for phones only - on a wider screen the WhatsApp bubble sits below. */
.help-widget-wa { display: none; }
/* Phone: ONE floating button. The help button takes the WhatsApp slot and the WhatsApp bubble goes (its link
   moves into this menu) - two stacked bubbles covered the right edge of every card and button. It steps aside
   while a field is focused so it never sits on the field being typed in. An open panel stays put. */
@media (max-width: 640px) {
  .help-widget { right: calc(.75rem + env(safe-area-inset-right, 0px)); bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); }
  .help-widget-btn { width: 2.6rem; height: 2.6rem; }
  .help-widget-wa { display: block; }
  body:has(.help-widget) .mx-wa-float { display: none; }
  body:has(main :is(input, select, textarea):focus) .help-widget:not([open]) { display: none; }
  /* Room at the end of the page so the last button/field can scroll clear of the floating button. */
  body:has(.help-widget) main { padding-bottom: 4rem; }
}

/* ── Tickets ─────────────────────────────────────────────────────────────── */
.tkt { max-width: 56rem; margin: 1.5rem auto; padding: 0 1rem; }
.tkt-head h1 { margin-bottom: .25rem; }
.tkt-head p { color: var(--bs-secondary-color); margin: 0; }
.tkt-cols { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 1.5rem; align-items: start; }
@media (min-width: 48rem) { .tkt-cols { grid-template-columns: 1.15fr 1fr; } }
/* Both columns are paper panels. The form used to be bare fields on the page ground and
   the ticket list a headed run of hairlines - the whole page read as one cream wash. */
.tkt-list-col, .tkt-new-col {
  background: var(--mx-nav-card); border: 1px solid var(--bs-border-color);
  border-radius: 14px; padding: 1.1rem 1.25rem 1.25rem; box-shadow: var(--mx-elevation-sm);
}
.tkt-subhead { font-size: 1.02rem; font-weight: 700; margin: 0 0 .8rem; color: var(--bs-heading-color); }
.tkt-form .form-label { margin-bottom: .15rem; font-size: .84rem; font-weight: 600; color: var(--bs-secondary-color); }
.tkt-form .btn { align-self: flex-start; margin-top: .4rem; }
.tkt-list { list-style: none; padding: 0; margin: 0; }
.tkt-list-item a { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--bs-border-color); text-decoration: none; color: inherit; }
.tkt-num { font-family: var(--mx-mono, monospace); color: var(--bs-secondary-color); }
.tkt-subject { font-weight: 600; }
.tkt-when { font-size: .8rem; color: var(--bs-secondary-color); }
.tkt-muted { opacity: .7; }
.tkt-form { display: flex; flex-direction: column; gap: .5rem; }

.tkt-pill { font-size: .75rem; padding: .1rem .6rem; border-radius: 999px; background: var(--bs-tertiary-bg); }
.tkt-pill-waitingonstaff { background: #fde8cf; color: #8a5300; }
.tkt-pill-waitingoncandidate { background: #d7ecff; color: #0a5591; }
.tkt-pill-resolved { background: #d8f3e3; color: #0c6b45; }
.tkt-pill-closed { background: #e6e6e6; color: #555; }

.tkt-thread-page { max-width: 46rem; }
.tkt-back { display: inline-block; margin-bottom: .75rem; text-decoration: none; }
.tkt-thread-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tkt-thread { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0; }
.tkt-msg { padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--bs-border-color); }
.tkt-msg-me { background: var(--bs-tertiary-bg); }
.tkt-msg-staff { background: var(--mx-nav-card); border-color: var(--mx-teal, #0c7a62); }
.tkt-msg-note { background: #fff8e6; border-color: #e6c66b; }
.tkt-msg-meta { font-size: .78rem; color: var(--bs-secondary-color); margin-bottom: .25rem; }
.tkt-msg-body { white-space: pre-wrap; line-height: 1.5; }
.tkt-msg-files { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tkt-file { font-size: .8rem; text-decoration: none; border: 1px solid var(--bs-border-color); border-radius: 6px; padding: .1rem .5rem; }
.tkt-reply { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.tkt-reply-actions { display: flex; gap: .5rem; }
.tkt-pending { font-size: .8rem; opacity: .7; }
.tkt-notfound { text-align: center; padding: 2rem 0; }

/* ── Surveys ─────────────────────────────────────────────────────────────── */
.svy-card { position: relative; border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .9rem 1rem; }
.svy-dismiss { position: absolute; top: .4rem; right: .5rem; background: transparent; border: none; font-size: 1.1rem; line-height: 1; cursor: pointer; opacity: .5; color: inherit; }
.svy-q { font-weight: 600; margin-bottom: .5rem; padding-right: 1rem; }
.svy-scale { display: flex; flex-wrap: wrap; gap: .3rem; }
.svy-dot { width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid var(--bs-border-color); background: transparent; cursor: pointer; color: inherit; }
.svy-dot.is-on, .svy-dot:hover { background: var(--mx-teal, #0c7a62); color: #fff; border-color: var(--mx-teal, #0c7a62); }
.svy-ends { display: flex; justify-content: space-between; font-size: .72rem; color: var(--bs-secondary-color); margin-top: .25rem; }
.svy-comment { display: flex; gap: .5rem; margin-top: .6rem; }
.svy-comment input { flex: 1; }
.svy-thanks { opacity: .8; }
.svy-inline { margin: 1rem 0; }

@media (prefers-color-scheme: dark) {
    .tkt-pill-waitingonstaff { background: #4a3410; color: #ffd9a3; }
    .tkt-pill-waitingoncandidate { background: #123b57; color: #bfe0ff; }
    .tkt-pill-resolved { background: #123f2c; color: #b9edcf; }
    .tkt-pill-closed { background: #333; color: #ccc; }
    .tkt-msg-note { background: #3a3413; border-color: #7a6a2a; }
}
