/* Chat, the staff help assistant (public/assets/chat.js), on the home page. The chosen design
   is church-help-bot/prototypes/round1/2-side-sheet.html, renamed Chat. Every class starts with
   ch- so nothing here touches app.css or home.css names. Colors are the site's own tokens
   from app.css; the site is dark only (app.css), so one set of colors covers it. Small text
   uses --muted, never --faint: --faint on these backgrounds is under 4.5 to 1 (--muted is
   6.3 to 1 or better). Phone first: under 700 wide the sheet is full screen; wider, it is a
   panel on the right that leaves the tiles usable beside it. */

/* ---------- The banner on the home page ---------- */
.ch-launch-wrap { min-width: 0; }
.ch-launch {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 9px 12px;
  border: 1px solid rgba(91, 108, 255, .42); border-radius: var(--radius);
  background: radial-gradient(120% 140% at 0% 0%, rgba(91, 108, 255, .2), transparent 60%), var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.ch-launch:active { background: var(--surface-2); }
.ch-launch__text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.ch-launch__name { font-size: 15px; line-height: 1.25; font-weight: 600; }
.ch-launch__hint { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.ch-launch__go {
  flex: none; padding: 6px 13px; border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 600;
}
.ch-launch__chips { display: none; }

.ch-badge {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #8f6bff); color: #fff;
}
.ch-badge .ch-i { width: 21px; height: 21px; }
.ch-badge--sm { width: 24px; height: 24px; border-radius: 7px; }
.ch-badge--sm .ch-i { width: 15px; height: 15px; }
.ch-i { width: 18px; height: 18px; flex: none; }
.ch-flip { transform: rotate(180deg); }
.ch-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- The sheet ---------- */
.ch-sheet {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--bg-2); color: var(--ink); font: 400 15px/1.45 var(--font);
}
.ch-sheet[hidden] { display: none !important; }
html.ch-lock, html.ch-lock body { overflow: hidden; }
.ch-sheet :focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.ch-sheet button { font-family: inherit; -webkit-tap-highlight-color: transparent; }

.ch-head {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 8px 6px 20px;
  border-bottom: 1px solid var(--line);
}
.ch-title { margin: 0 auto 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; outline: none; }
/* The title takes focus only so a phone opens without the keyboard; it is not a control. */
.ch-sheet .ch-title:focus, .ch-sheet .ch-title:focus-visible { outline: none; }
.ch-hbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px;
  padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ch-hbtn:hover, .ch-hbtn:active { background: var(--surface-2); color: var(--ink); }
.ch-hbtn--x { padding: 0; }
.ch-hbtn--x .ch-i { width: 20px; height: 20px; }

.ch-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.ch-log { display: flex; flex-direction: column; gap: 14px; }

.ch-hello__t { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; }
.ch-hello__p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.ch-teams { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 18px 0 10px; }
.ch-lbl { margin: 0 6px 0 0; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.ch-team {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ch-team:hover { color: var(--ink); }
.ch-team[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-2); }
.ch-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-chip {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-size: 14px; line-height: 1.3; text-align: left; cursor: pointer;
}
.ch-chip:hover { border-color: var(--brand); background: var(--surface-3); }

.ch-me {
  align-self: flex-end; max-width: 85%; padding: 9px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--brand); color: #fff; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ch-ans {
  min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px;
  background: var(--surface);
}
.ch-ans.is-error { border-color: rgba(251, 111, 146, .35); }
.ch-who { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* The answer itself. Only p, ol, ul, li, strong, code, a and br ever appear in here. */
.ch-md { overflow-wrap: anywhere; font-size: 15px; }
.ch-md > :first-child { margin-top: 0; }
.ch-md > :last-child { margin-bottom: 0; }
.ch-md p { margin: 0 0 10px; }
.ch-md .ch-head { margin-top: 14px; }
.ch-md .ch-pre { margin: 0 0 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.ch-md ol, .ch-md ul { margin: 0 0 10px; padding-left: 24px; }
.ch-md li { margin: 0 0 6px; padding-left: 2px; }
.ch-md li::marker { color: var(--brand-2); font-weight: 700; }
.ch-md strong { font-weight: 700; }
.ch-md code {
  padding: 1px 6px; border-radius: 6px; background: var(--surface-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
}
.ch-md a { color: var(--brand-2); text-decoration: underline; text-underline-offset: 2px; }
.ch-md a:hover { color: var(--ink); }

.ch-typing { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-size: 14px; }
.ch-dots { display: inline-flex; gap: 4px; }
.ch-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); animation: ch-dot 1.2s infinite ease-in-out; }
.ch-dots i:nth-child(2) { animation-delay: .15s; }
.ch-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ch-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ch-dots i { animation: none; opacity: .7; } }

.ch-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
.ch-note--err { padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--ink); }
.ch-note--err .ch-i { color: var(--red); }
.ch-note--err span { flex: 1; min-width: 12rem; }
.ch-link { color: var(--brand-2); font-weight: 600; text-decoration: underline; }

.ch-guide {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg);
}
.ch-guide__top { display: flex; align-items: center; gap: 12px; }
.ch-guide__md { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ch-guide__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.ch-guide__ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.ch-guide__t { flex: 1; min-width: 10rem; }
.ch-guide__t b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ch-guide__t small { color: var(--muted); font-size: 12.5px; }
.ch-soon { color: var(--muted); font-size: 12.5px; font-weight: 600; }

.ch-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ch-thumbs { display: inline-flex; gap: 6px; margin-left: auto; }
.ch-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ch-btn:hover { background: var(--surface-3); }
.ch-btn:disabled, .ch-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.ch-btn--sq { width: 44px; padding: 0; }
.ch-btn--ghost { background: none; border-color: transparent; color: var(--muted); }
.ch-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }

.ch-why { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.ch-why label { display: block; margin-bottom: 8px; font-size: 13.5px; color: var(--muted); }
.ch-why__q, .ch-q {
  display: block; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: 12px; background: var(--surface); color: var(--ink); font: 400 16px/1.4 var(--font); resize: none;
}
.ch-why__row { display: flex; gap: 8px; margin-top: 8px; }
.ch-thanks { margin: 10px 0 0; color: var(--green); font-size: 13.5px; }
.ch-fu { margin-top: 14px; }
.ch-fu .ch-lbl { margin: 0 0 8px; }

/* ---------- Composer and the AI note ---------- */
.ch-composer {
  flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 20px 6px;
  border-top: 1px solid var(--line); background: var(--bg-2);
}
.ch-q { flex: 1; min-height: 46px; max-height: 160px; border-radius: 14px; }
.ch-q::placeholder { color: var(--muted); opacity: 1; }
.ch-send {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
}
.ch-send:hover { filter: brightness(1.08); }
.ch-send--stop { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.ch-send[hidden] { display: none; }
.ch-foot {
  flex: none; margin: 0; padding: 0 20px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-2); color: var(--muted); font-size: 12px; line-height: 1.35;
}

/* ---------- Wider: a panel on the right ---------- */
@media (min-width: 700px) {
  .ch-launch__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .ch-launch__chips .ch-chip { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  .ch-sheet {
    left: auto; width: 440px; height: auto; padding: 0;
    border-left: 1px solid var(--line-2); box-shadow: -24px 0 48px rgba(0, 0, 0, .5);
  }
}
@media (min-width: 900px) {
  .ch-launch:hover { background: radial-gradient(120% 140% at 0% 0%, rgba(91, 108, 255, .26), transparent 60%), var(--surface-2); border-color: var(--brand-2); }
}
/* Room for the panel: the page moves left so nothing hides under it. */
@media (min-width: 1100px) {
  html.ch-open .hm-page, html.ch-open .hm-top__in { margin-right: 456px; }
}
/* With Chat in the middle row, Staff Meetings lines up with the Chat banner, not its chips. */
@media (min-width: 900px) {
  .hm-mid:has(.ch-launch-wrap) { align-items: flex-start; }
}
