/*
 * Tasks4Access website support assistant ("Ask Tasks4Access").
 * Uses only the site's own design tokens (tokens.css) so it reads as part of the site:
 * brand gradient, Inter, 14/15/22px radii, lilac surfaces, indigo focus ring.
 * Namespaced .t4a-sa-* ; touches nothing else on the page.
 */

.t4a-sa-launcher,
.t4a-sa-panel,
.t4a-sa-panel * {
  box-sizing: border-box;
  font-family: var(--t4a-font);
}

/* ---------------------------------------------------------------- launcher */
.t4a-sa-launcher {
  --t4a-sa-offset: 0px;
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--t4a-sa-offset));
  z-index: 99980;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--t4a-radius-button);
  background: var(--t4a-gradient-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(79, 70, 229, .32);
  transition: transform .18s ease, filter .18s ease, bottom .2s ease;
}
.t4a-sa-launcher:hover { filter: brightness(1.06); transform: translateY(-1px); }
.t4a-sa-launcher:focus-visible { outline: 3px solid var(--t4a-lilac-2); outline-offset: 3px; }
.t4a-sa-launcher svg { flex: none; }

/* ------------------------------------------------------------------ panel */
.t4a-sa-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  width: 392px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 32px));
  background: var(--t4a-surface);
  color: var(--t4a-text);
  border: 1px solid var(--t4a-border);
  border-radius: var(--t4a-radius-card);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .24);
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
}
.t4a-sa-panel[hidden] { display: none; }

.t4a-sa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px 20px;
  background: var(--t4a-gradient-primary);
  color: #fff;
}
.t4a-sa-panel .t4a-sa-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.25; color: #fff; }
.t4a-sa-panel .t4a-sa-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.4; opacity: .9; color: #fff; }
.t4a-sa-close {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -6px -6px 0 0;
  border: 0;
  border-radius: var(--t4a-radius-button);
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.t4a-sa-close:hover { background: rgba(255, 255, 255, .16); }
.t4a-sa-close:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

/* --------------------------------------------------------------------- log */
.t4a-sa-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background: var(--t4a-bg);
}
.t4a-sa-msg { display: flex; margin: 0 0 10px; }
.t4a-sa-msg--user { justify-content: flex-end; }
.t4a-sa-bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--t4a-surface);
  border: 1px solid var(--t4a-border);
  color: var(--t4a-text);
  overflow-wrap: anywhere;
}
.t4a-sa-panel .t4a-sa-bubble p { margin: 0 0 8px; }
.t4a-sa-panel .t4a-sa-bubble p:last-child { margin-bottom: 0; }
.t4a-sa-msg--user .t4a-sa-bubble {
  background: var(--t4a-purple);
  border-color: var(--t4a-purple);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.t4a-sa-msg--bot .t4a-sa-bubble { border-bottom-left-radius: 6px; }
.t4a-sa-bubble--answer { max-width: 100%; width: 100%; background: var(--t4a-surface); }
.t4a-sa-bubble--typing { background: var(--t4a-lilac); border-color: var(--t4a-lilac-2); color: var(--t4a-muted); }
.t4a-sa-panel .t4a-sa-muted { color: var(--t4a-muted); font-size: 14px; }
.t4a-sa-panel .t4a-sa-lead { font-weight: 600; color: var(--t4a-purple-2); }

.t4a-sa-panel .t4a-sa-article-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--t4a-navy); }
.t4a-sa-article ul, .t4a-sa-article ol { margin: 0 0 8px; padding-left: 20px; }
.t4a-sa-article li { margin: 0 0 4px; }
.t4a-sa-article a, .t4a-sa-panel a { color: var(--t4a-purple); text-decoration: underline; font-weight: 600; }
.t4a-sa-tags { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.t4a-sa-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--t4a-lilac);
  color: var(--t4a-purple-2);
  font-size: 12px;
  font-weight: 600;
}
.t4a-sa-panel .t4a-sa-label { margin: 10px 0 6px; font-size: 13px; font-weight: 600; color: var(--t4a-muted); }

/* ------------------------------------------------------------- chips/buttons */
.t4a-sa-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.t4a-sa-actions--list { flex-direction: column; align-items: stretch; }
.t4a-sa-chip {
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--t4a-lilac-2);
  border-radius: var(--t4a-radius-button);
  background: var(--t4a-surface);
  color: var(--t4a-purple-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.t4a-sa-chip:hover { border-color: var(--t4a-purple); background: var(--t4a-lilac); }
.t4a-sa-chip--primary { background: var(--t4a-purple); border-color: var(--t4a-purple); color: #fff; }
.t4a-sa-chip--primary:hover { background: var(--t4a-purple-2); border-color: var(--t4a-purple-2); }
.t4a-sa-chip:focus-visible,
.t4a-sa-input:focus-visible,
.t4a-sa-send:focus-visible,
.t4a-sa-linkbtn:focus-visible,
.t4a-sa-form :focus-visible { outline: 3px solid var(--t4a-lilac-2); outline-offset: 2px; box-shadow: 0 0 0 1px var(--t4a-purple); }

/* ---------------------------------------------------------------- composer */
.t4a-sa-composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--t4a-surface);
  border-top: 1px solid var(--t4a-border);
}
.t4a-sa-composer[hidden] { display: none; }
.t4a-sa-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--t4a-border);
  border-radius: var(--t4a-radius-input);
  background: var(--t4a-surface);
  color: var(--t4a-text);
  font-size: 16px; /* >=16px stops iOS Safari zooming the page on focus */
}
.t4a-sa-send {
  flex: none;
  min-width: 64px;
  height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--t4a-radius-button);
  background: var(--t4a-gradient-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.t4a-sa-send[disabled] { opacity: .5; cursor: not-allowed; }

.t4a-sa-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 12px;
  background: var(--t4a-surface);
}
.t4a-sa-panel .t4a-sa-privacy { margin: 0; font-size: 12px; line-height: 1.35; font-weight: 400; color: var(--t4a-muted); }
.t4a-sa-linkbtn {
  flex: none;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--t4a-purple);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------------------------------------------------------- escalation form */
.t4a-sa-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--t4a-surface);
  border-top: 1px solid var(--t4a-border);
}
.t4a-sa-panel .t4a-sa-form h3 { margin: 0 0 4px; font-size: 16px; color: var(--t4a-navy); }
.t4a-sa-field { margin: 12px 0 0; }
.t4a-sa-field label { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--t4a-text); }
.t4a-sa-field input,
.t4a-sa-field select,
.t4a-sa-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--t4a-border);
  border-radius: var(--t4a-radius-input);
  background: var(--t4a-surface);
  color: var(--t4a-text);
  font-size: 16px;
}
.t4a-sa-field textarea { resize: vertical; }
.t4a-sa-panel .t4a-sa-hint { margin: 4px 0 0; font-size: 12px; color: var(--t4a-muted); }
.t4a-sa-panel .t4a-sa-error { min-height: 20px; margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--t4a-danger); }
.t4a-sa-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.t4a-sa-submit { min-height: 46px; }
.t4a-sa-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none;
}

/* ------------------------------------------------------------------ mobile */
@media (max-width: 600px) {
  .t4a-sa-launcher { right: 12px; bottom: calc(12px + var(--t4a-sa-offset)); }
  .t4a-sa-launcher.is-open { display: none; }
  .t4a-sa-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .t4a-sa-bubble { max-width: 96%; }
  html.t4a-sa-lock { overflow: hidden; }
}
/* Tablet: keep the floating card, a little roomier. */
@media (min-width: 601px) and (max-width: 1023px) {
  .t4a-sa-panel { width: 420px; height: min(680px, calc(100vh - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
  .t4a-sa-launcher, .t4a-sa-chip { transition: none; }
}

/* Theme paragraph/list sizes must not leak into the widget. */
.t4a-sa-panel .t4a-sa-bubble,
.t4a-sa-panel .t4a-sa-bubble p,
.t4a-sa-panel .t4a-sa-bubble li,
.t4a-sa-panel .t4a-sa-form p { font-size: 15px; line-height: 1.5; }
.t4a-sa-panel .t4a-sa-bubble p, .t4a-sa-panel .t4a-sa-form p { margin: 0 0 8px; }
.t4a-sa-panel .t4a-sa-bubble ul, .t4a-sa-panel .t4a-sa-bubble ol { margin: 0 0 8px; }
@media (max-width: 600px) {
  .t4a-sa-panel.has-form .t4a-sa-log { display: none; }
}

/* Compact topic chips in the greeting so the welcome text stays visible. */
.t4a-sa-chip--sm { min-height: 38px; padding: 6px 12px; font-size: 13px; border-radius: 12px; }
.t4a-sa-chip--more { border-style: dashed; }
.t4a-sa-actions:has(.t4a-sa-chip--sm) { gap: 6px; }

/* ------------------------------------------------- guided troubleshooting flows */
.t4a-sa-bubble--flow { max-width: 100%; width: 100%; }
.t4a-sa-panel .t4a-sa-flow-heading { margin: 0 0 8px; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--t4a-navy); }
.t4a-sa-flow-heading:focus { outline: none; }
.t4a-sa-flow-heading:focus-visible { outline: 3px solid var(--t4a-lilac-2); outline-offset: 2px; }
.t4a-sa-panel .t4a-sa-flow-confirm { margin-top: 10px; font-weight: 700; }
.t4a-sa-flows { margin: 4px 0 0; width: 100%; }
.t4a-sa-flows .t4a-sa-actions { margin-bottom: 0; }
.t4a-sa-panel .t4a-sa-flows-title { margin: 12px 0 6px; font-size: 13px; }
.t4a-sa-chip--flow { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.t4a-sa-flow-t { font-weight: 700; }
.t4a-sa-flow-s { font-weight: 400; font-size: 13px; color: var(--t4a-muted); }
.t4a-sa-actions--list .t4a-sa-chip { width: 100%; }
.t4a-sa-chip[disabled] { opacity: .55; cursor: not-allowed; }
.t4a-sa-panel .t4a-sa-callout { margin: 0 0 8px; padding: 8px 10px; border-left: 4px solid var(--t4a-purple); border-radius: 8px; background: var(--t4a-lilac); }
.t4a-sa-panel .t4a-sa-callout--warn { border-left-color: var(--t4a-danger); border-left-style: double; background: var(--t4a-surface); border: 1.5px solid var(--t4a-danger); border-left-width: 6px; }
.t4a-sa-bubble--safety { border: 2px solid var(--t4a-danger); max-width: 100%; width: 100%; }
.t4a-sa-flow-nav { margin-top: -4px; }
.t4a-sa-flow-nav .t4a-sa-chip { min-width: 44px; }
.t4a-sa-bubble--flow, .t4a-sa-bubble--flow p, .t4a-sa-bubble--flow li { min-width: 0; }

/* Phase 2: account check results */
.t4a-sa-diag-card { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--t4a-border, #d9dcea); border-radius: 10px; background: var(--t4a-surface, #fff); }
.t4a-sa-diag-card h4 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--t4a-navy); }
.t4a-sa-diag-card ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.t4a-sa-diag-card li { margin: 0 0 4px; }
.t4a-sa-panel .t4a-sa-hint { margin: 8px 0 0; font-size: 13px; color: var(--t4a-text); }

/* Start again: always visible in the header */
.t4a-sa-headtext { flex: 1 1 auto; min-width: 0; }
.t4a-sa-restart {
  flex: none;
  min-height: 36px;
  margin: 0 4px 0 0;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.t4a-sa-restart:hover { background: rgba(255, 255, 255, .24); }
.t4a-sa-restart:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Phase 4: action results */
.t4a-sa-secret-label { margin: 10px 0 2px; font-size: 13px; font-weight: 700; color: var(--t4a-text); }
.t4a-sa-secret { margin: 0 0 6px; padding: 10px 12px; font: 700 28px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .18em; text-align: center; color: var(--t4a-navy); background: var(--t4a-lilac-1, #EEF0FF); border-radius: 10px; }

/* The analytics consent banner must not cover the open chat (its box and Send button); it returns when the chat is closed. */
html.t4a-sa-lock #t4a-consent-banner { z-index: 99985 !important; }
