/* Quarto AI Assistant. Every rule is scoped to #qa-root so Bootstrap-based ERP screens are untouched. */

#qa-root {
  --qa-blue: #4f6bff;
  --qa-violet: #8b5cf6;
  --qa-pink: #e8618c;
  --qa-teal: #14b8a6;
  --qa-gradient: linear-gradient(135deg, #4f6bff 0%, #8b5cf6 52%, #e8618c 100%);
  --qa-ink: #0f172a;
  --qa-ink-2: #334155;
  --qa-muted: #64748b;
  --qa-line: #e6e8f0;
  --qa-surface: #ffffff;
  --qa-surface-2: #f6f7fb;
  --qa-surface-3: #eef0f8;
  --qa-radius: 24px;
  --qa-shadow: 0 24px 64px -16px rgba(30, 27, 75, 0.28), 0 8px 24px -12px rgba(30, 27, 75, 0.18);
  --qa-font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Malayalam", "Noto Sans Devanagari", sans-serif;
  --qa-ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--qa-font);
  color: var(--qa-ink);
  line-height: 1.5;
}

#qa-root *,
#qa-root *::before,
#qa-root *::after {
  box-sizing: border-box;
}

#qa-root button,
#qa-root select,
#qa-root textarea {
  font-family: inherit;
  letter-spacing: normal;
}

#qa-root button {
  cursor: pointer;
}

#qa-root button:disabled {
  cursor: not-allowed;
}

#qa-root :focus-visible {
  outline: 2px solid var(--qa-violet);
  outline-offset: 2px;
}

#qa-root [hidden] {
  display: none !important;
}

#qa-root h2,
#qa-root h3,
#qa-root p {
  margin: 0;
}

/* ---------- Launcher ---------- */

#qa-root .qa-launcher {
  position: fixed;
  right: 22px;
  bottom: 78px;
  z-index: 1044;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 56px;
  min-width: 56px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--qa-gradient);
  background-size: 200% 200%;
  box-shadow: 0 14px 34px -10px rgba(99, 72, 230, 0.65);
  animation: qa-gradient-shift 8s ease infinite;
  touch-action: none;
  cursor: grab;
  transition: transform 0.35s var(--qa-ease), box-shadow 0.35s var(--qa-ease), opacity 0.25s ease;
}

#qa-root .qa-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -10px rgba(99, 72, 230, 0.75);
}

#qa-root .qa-launcher.is-dragging,
#qa-root .qa-launcher.is-dragging:hover {
  cursor: grabbing;
  transform: none;
  transition: none;
}

#qa-root .qa-launcher__glow {
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: inherit;
  background: var(--qa-gradient);
  filter: blur(14px);
  opacity: 0.45;
  animation: qa-breathe 3.6s ease-in-out infinite;
}

#qa-root .qa-launcher__core {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

#qa-root .qa-launcher__core svg {
  animation: qa-twinkle 4s ease-in-out infinite;
}

#qa-root .qa-launcher__label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: max-width 0.4s var(--qa-ease), opacity 0.25s ease, padding 0.4s var(--qa-ease);
}

#qa-root .qa-launcher:hover .qa-launcher__label,
#qa-root .qa-launcher:focus-visible .qa-launcher__label {
  max-width: 160px;
  padding-right: 20px;
  opacity: 1;
}

#qa-root.is-open .qa-launcher {
  transform: scale(0.6);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Panel ---------- */

#qa-root .qa-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  width: 420px;
  height: min(720px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--qa-radius);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(139, 92, 246, 0.08), transparent 60%),
    radial-gradient(90% 50% at 0% 0%, rgba(79, 107, 255, 0.08), transparent 60%),
    var(--qa-surface);
  box-shadow: var(--qa-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 0.28s ease,
    transform 0.4s var(--qa-ease),
    width 0.4s var(--qa-ease),
    height 0.4s var(--qa-ease),
    visibility 0s linear 0.4s;
}

#qa-root .qa-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.28s ease,
    transform 0.4s var(--qa-ease),
    width 0.4s var(--qa-ease),
    height 0.4s var(--qa-ease),
    visibility 0s;
}

#qa-root .qa-panel.is-expanded {
  width: min(760px, calc(100vw - 40px));
  height: calc(100vh - 40px);
}

#qa-root .qa-panel.is-minimized {
  width: 320px;
  height: 52px;
  min-height: 0;
}

#qa-root .qa-panel.is-minimized .qa-scroll,
#qa-root .qa-panel.is-minimized .qa-composer,
#qa-root .qa-panel.is-minimized .qa-footnote,
#qa-root .qa-panel.is-minimized .qa-notice {
  display: none !important;
}

#qa-root .qa-panel.is-minimized .qa-header {
  border-bottom: none;
}

/* ---------- Header ---------- */

#qa-root .qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid rgba(230, 232, 240, 0.7);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
}

#qa-root .qa-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#qa-root .qa-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #fff;
  background: var(--qa-gradient);
  box-shadow: 0 6px 16px -6px rgba(139, 92, 246, 0.7);
}

#qa-root .qa-avatar--sm {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

#qa-root .qa-header h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--qa-ink);
}

#qa-root .qa-presence {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--qa-muted);
}

#qa-root .qa-presence__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

#qa-root .qa-presence[data-state="online"] .qa-presence__dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

#qa-root .qa-presence[data-state="offline"] .qa-presence__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

#qa-root .qa-presence[data-state="busy"] .qa-presence__dot {
  background: var(--qa-violet);
  animation: qa-pulse-dot 1.2s ease-in-out infinite;
}

#qa-root .qa-header__actions {
  display: flex;
  gap: 2px;
}

#qa-root .qa-icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--qa-muted);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

#qa-root .qa-icon-btn:hover {
  color: var(--qa-ink);
  background: var(--qa-surface-3);
}

/* ---------- Notice banner ---------- */

#qa-root .qa-notice {
  display: flex;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  font-size: 13px;
  color: #78350f;
  background: #fffbeb;
}

#qa-root .qa-notice[data-tone="error"] {
  border-color: #fecdd3;
  color: #881337;
  background: #fff1f2;
}

#qa-root .qa-notice strong {
  display: block;
  font-weight: 600;
}

/* ---------- Scroll area & welcome ---------- */

#qa-root .qa-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #d5d8e4 transparent;
}

#qa-root .qa-welcome {
  padding: 28px 4px 12px;
  animation: qa-rise 0.5s var(--qa-ease) both;
}

#qa-root .qa-welcome__title {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

#qa-root .qa-gradient-text {
  color: transparent;
  background: var(--qa-gradient);
  background-clip: text;
  -webkit-background-clip: text;
}

#qa-root .qa-welcome__subtitle {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #9aa3b5;
}

#qa-root .qa-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

#qa-root .qa-panel.is-expanded .qa-suggestions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#qa-root .qa-suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--qa-line);
  border-radius: 18px;
  text-align: left;
  color: var(--qa-ink);
  background: var(--qa-surface-2);
  transition: transform 0.25s var(--qa-ease), border-color 0.2s ease, background 0.2s ease, box-shadow 0.25s ease;
}

#qa-root .qa-suggestion:hover {
  transform: translateY(-2px);
  border-color: #d7d2fb;
  background: #fff;
  box-shadow: 0 10px 24px -14px rgba(76, 61, 180, 0.45);
}

#qa-root .qa-suggestion__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  border-radius: 10px;
}

#qa-root .qa-tone-blue { color: #3756f5; background: #e7ecff; }
#qa-root .qa-tone-teal { color: #0f9488; background: #dcf7f2; }
#qa-root .qa-tone-violet { color: #7c3aed; background: #efe7ff; }
#qa-root .qa-tone-rose { color: #db2777; background: #ffe6f0; }

#qa-root .qa-suggestion__title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}

#qa-root .qa-suggestion__hint {
  font-size: 12px;
  line-height: 1.35;
  color: var(--qa-muted);
}

/* ---------- Thread ---------- */

#qa-root .qa-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

#qa-root .qa-row {
  display: flex;
  gap: 10px;
  animation: qa-rise 0.35s var(--qa-ease) both;
}

#qa-root .qa-row--user {
  justify-content: flex-end;
}

#qa-root .qa-row__body {
  min-width: 0;
  max-width: 100%;
}

#qa-root .qa-row--user .qa-row__body {
  width: fit-content;
  max-width: 82%;
}

#qa-root .qa-row--assistant .qa-row__body {
  flex: 1 1 auto;
  padding-top: 3px;
}

#qa-root .qa-bubble {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#qa-root .qa-row--user .qa-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 20px 20px 6px 20px;
  color: #fff;
  background: var(--qa-gradient);
  box-shadow: 0 8px 20px -12px rgba(99, 72, 230, 0.7);
}

#qa-root .qa-row--assistant .qa-bubble {
  color: var(--qa-ink-2);
}

#qa-root .qa-row--error .qa-bubble {
  padding: 10px 12px;
  border: 1px solid #fecdd3;
  border-radius: 14px;
  color: #9f1239;
  background: #fff1f2;
}

#qa-root .qa-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

#qa-root .qa-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--qa-line);
  border-radius: 12px;
  font-size: 13px;
  color: var(--qa-ink);
  background: #fff;
}

#qa-root .qa-results li::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--qa-gradient);
}

#qa-root .qa-row__meta {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#qa-root .qa-row:hover .qa-row__meta,
#qa-root .qa-row:focus-within .qa-row__meta {
  opacity: 1;
}

#qa-root .qa-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  color: var(--qa-muted);
  background: transparent;
}

#qa-root .qa-mini-btn:hover {
  color: var(--qa-ink);
  background: var(--qa-surface-3);
}

/* Typing indicator */
#qa-root .qa-typing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--qa-muted);
}

#qa-root .qa-typing__dots {
  display: inline-flex;
  gap: 4px;
}

#qa-root .qa-typing__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--qa-violet);
  animation: qa-bounce 1.2s ease-in-out infinite;
}

#qa-root .qa-typing__dots span:nth-child(2) { animation-delay: 0.15s; background: var(--qa-blue); }
#qa-root .qa-typing__dots span:nth-child(3) { animation-delay: 0.3s; background: var(--qa-pink); }

#qa-root .qa-shimmer {
  color: transparent;
  background: linear-gradient(90deg, #94a3b8 0%, #94a3b8 40%, #4f46e5 50%, #94a3b8 60%, #94a3b8 100%);
  background-size: 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: qa-shimmer 2s linear infinite;
}

/* ---------- Choices ---------- */

#qa-root .qa-choice-group {
  margin-top: 10px;
}

#qa-root .qa-choice-group__label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--qa-muted);
}

#qa-root .qa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#qa-root .qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 14px;
  border: 1px solid var(--qa-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--qa-ink);
  background: #fff;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#qa-root .qa-chip:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #c4b5fd;
  background: #f7f4ff;
}

#qa-root .qa-chip.is-selected {
  border-color: transparent;
  color: #fff;
  background: var(--qa-gradient);
}

#qa-root .qa-chip:disabled:not(.is-selected) {
  opacity: 0.45;
}

/* ---------- Preview card ---------- */

#qa-root .qa-preview {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--qa-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px -20px rgba(30, 27, 75, 0.45);
}

#qa-root .qa-preview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--qa-line);
  background: linear-gradient(135deg, rgba(79, 107, 255, 0.07), rgba(232, 97, 140, 0.07));
}

#qa-root .qa-preview__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--qa-ink);
}

#qa-root .qa-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: #92400e;
  background: #fef3c7;
}

#qa-root .qa-badge--done {
  color: #166534;
  background: #dcfce7;
}

#qa-root .qa-badge--muted {
  color: var(--qa-muted);
  background: var(--qa-surface-3);
}

#qa-root .qa-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin: 0;
  padding: 14px;
}

#qa-root .qa-fields div {
  min-width: 0;
}

#qa-root .qa-fields dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--qa-muted);
}

#qa-root .qa-fields dd {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  color: var(--qa-ink);
}

#qa-root .qa-lines {
  margin: 0 14px;
  overflow-x: auto;
  border: 1px solid var(--qa-line);
  border-radius: 12px;
}

#qa-root .qa-lines table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 12.5px;
}

#qa-root .qa-lines th,
#qa-root .qa-lines td {
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--qa-line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

#qa-root .qa-lines th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--qa-muted);
  background: var(--qa-surface-2);
}

#qa-root .qa-lines td.qa-num,
#qa-root .qa-lines th.qa-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#qa-root .qa-lines tr:last-child td {
  border-bottom: 0;
}

#qa-root .qa-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--qa-surface-2);
}

#qa-root .qa-total span {
  font-size: 12px;
  font-weight: 600;
  color: var(--qa-muted);
}

#qa-root .qa-total strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

#qa-root .qa-tech {
  margin: 12px 14px 0;
  font-size: 12px;
  color: var(--qa-muted);
}

#qa-root .qa-tech summary {
  cursor: pointer;
  user-select: none;
}

#qa-root .qa-tech pre {
  max-height: 200px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 10px;
  font-size: 11px;
  white-space: pre-wrap;
  color: #e2e8f0;
  background: #0f172a;
}

#qa-root .qa-preview__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px;
}

#qa-root .qa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

#qa-root .qa-btn--primary {
  color: #fff;
  background: var(--qa-gradient);
  box-shadow: 0 10px 22px -12px rgba(99, 72, 230, 0.8);
}

#qa-root .qa-btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

#qa-root .qa-btn--ghost {
  border-color: var(--qa-line);
  color: var(--qa-ink-2);
  background: #fff;
}

#qa-root .qa-btn--ghost:hover:not(:disabled) {
  background: var(--qa-surface-2);
}

#qa-root .qa-btn:disabled {
  opacity: 0.6;
}

#qa-root .qa-preview.is-settled .qa-preview__actions {
  display: none;
}

/* ---------- Composer ---------- */

#qa-root .qa-composer-wrap {
  position: relative;
  padding: 8px 14px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 30%);
}

#qa-root .qa-suggest {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% - 6px);
  z-index: 2;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--qa-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--qa-shadow);
  max-height: 220px;
  overflow: auto;
}

#qa-root .qa-suggest[hidden] {
  display: none !important;
}

#qa-root .qa-suggest__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
}

#qa-root .qa-suggest__item:hover,
#qa-root .qa-suggest__item.is-active {
  background: var(--qa-surface-2);
}

#qa-root .qa-suggest__name {
  font-size: 13px;
  font-weight: 600;
}

#qa-root .qa-suggest__detail {
  font-size: 11px;
  color: var(--qa-muted);
}

#qa-root .qa-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

#qa-root .qa-composer {
  margin: 0;
  padding: 10px 10px 8px 16px;
  border: 1px solid var(--qa-line);
  border-radius: 24px;
  background: var(--qa-surface-2);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

#qa-root .qa-composer:focus-within {
  border-color: #c7bdfb;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12), 0 10px 26px -18px rgba(76, 61, 180, 0.6);
}

#qa-root .qa-composer.is-transcript {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 4px rgba(79, 107, 255, 0.12);
}

#qa-root .qa-composer__input {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 160px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  outline: none;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--qa-ink);
  background: transparent;
  box-shadow: none;
}

#qa-root .qa-composer__input::placeholder {
  color: #9aa3b5;
}

#qa-root .qa-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

#qa-root .qa-composer__tools,
#qa-root .qa-composer__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

#qa-root .qa-chip-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--qa-line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--qa-ink-2);
  background: #fff;
}

#qa-root .qa-chip-select select {
  max-width: 120px;
  height: 100%;
  margin: 0;
  padding: 0 2px;
  border: 0;
  outline: none;
  font-size: 12.5px;
  font-weight: 500;
  color: inherit;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

#qa-root .qa-tool-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--qa-line);
  border-radius: 999px;
  color: var(--qa-muted);
  background: #fff;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#qa-root .qa-tool-btn:hover:not(:disabled) {
  color: var(--qa-ink);
}

#qa-root .qa-tool-btn[aria-pressed="true"] {
  border-color: transparent;
  color: #fff;
  background: var(--qa-gradient);
}

#qa-root .qa-tool-btn:disabled {
  opacity: 0.4;
}

#qa-root .qa-round-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transition: transform 0.2s var(--qa-ease), background 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

#qa-root .qa-round-btn--ghost {
  color: var(--qa-ink-2);
  background: transparent;
}

#qa-root .qa-round-btn--ghost:hover:not(:disabled) {
  background: var(--qa-surface-3);
}

#qa-root .qa-round-btn--primary {
  color: #fff;
  background: var(--qa-ink);
}

#qa-root .qa-round-btn--primary:not(:disabled) {
  background: var(--qa-gradient);
  box-shadow: 0 8px 18px -10px rgba(99, 72, 230, 0.9);
}

#qa-root .qa-round-btn--primary:hover:not(:disabled) {
  transform: scale(1.06);
}

#qa-root .qa-round-btn:disabled {
  opacity: 0.35;
}

#qa-root .qa-footnote {
  margin-top: 8px;
  font-size: 11px;
  text-align: center;
  color: #9aa3b5;
}

/* ---------- Voice mode ---------- */

#qa-root .qa-voice {
  --qa-level: 0;
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 24px 28px;
  color: #fff;
  background:
    radial-gradient(80% 50% at 50% 42%, rgba(139, 92, 246, 0.35), transparent 70%),
    radial-gradient(60% 40% at 20% 90%, rgba(79, 107, 255, 0.25), transparent 70%),
    radial-gradient(60% 40% at 85% 85%, rgba(232, 97, 140, 0.22), transparent 70%),
    #0b0b1a;
  animation: qa-fade 0.3s ease both;
}

#qa-root .qa-voice__top {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

#qa-root .qa-voice__badge,
#qa-root .qa-voice__timer {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
  font-variant-numeric: tabular-nums;
}

#qa-root .qa-orb {
  position: relative;
  width: 200px;
  height: 200px;
  margin: auto 0 28px;
  transform: scale(calc(1 + var(--qa-level) * 0.22));
  transition: transform 0.08s linear;
}

#qa-root .qa-orb__ring {
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  animation: qa-ring 3s ease-out infinite;
}

#qa-root .qa-orb__ring--2 {
  animation-delay: 1.5s;
}

#qa-root .qa-orb__blob {
  position: absolute;
  inset: 0;
  border-radius: 46% 54% 52% 48% / 52% 44% 56% 48%;
  filter: blur(14px);
  mix-blend-mode: screen;
  opacity: 0.9;
}

#qa-root .qa-orb__blob--a {
  background: radial-gradient(circle at 30% 30%, #6d8bff, transparent 65%);
  animation: qa-morph 7s ease-in-out infinite;
}

#qa-root .qa-orb__blob--b {
  background: radial-gradient(circle at 70% 40%, #b18cff, transparent 65%);
  animation: qa-morph 9s ease-in-out infinite reverse;
}

#qa-root .qa-orb__blob--c {
  background: radial-gradient(circle at 50% 75%, #ff7aa8, transparent 65%);
  animation: qa-morph 11s ease-in-out infinite;
}

#qa-root .qa-orb__core {
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, rgba(255, 255, 255, 0.55) 40%, transparent 72%);
  filter: blur(6px);
  opacity: calc(0.55 + var(--qa-level) * 0.45);
}

#qa-root .qa-voice.is-processing .qa-orb {
  animation: qa-spin 2.4s linear infinite;
}

#qa-root .qa-voice__state {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

#qa-root .qa-voice__hint {
  max-width: 300px;
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

#qa-root .qa-voice__controls {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 32px;
}

#qa-root .qa-voice__btn {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  transition: transform 0.2s var(--qa-ease), background 0.2s ease, opacity 0.2s ease;
}

#qa-root .qa-voice__btn:hover:not(:disabled) {
  transform: scale(1.06);
}

#qa-root .qa-voice__btn:disabled {
  opacity: 0.4;
}

#qa-root .qa-voice__btn--ghost {
  width: 56px;
  height: 56px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

#qa-root .qa-voice__btn--primary {
  width: 72px;
  height: 72px;
  color: #0b0b1a;
  background: #fff;
  box-shadow: 0 12px 30px -10px rgba(177, 140, 255, 0.8);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  #qa-root .qa-launcher {
    right: 16px;
    bottom: 72px;
  }

  #qa-root .qa-panel,
  #qa-root .qa-panel.is-expanded {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  #qa-root .qa-hide-mobile {
    display: none;
  }

  #qa-root .qa-welcome__title {
    font-size: 26px;
  }
}

/* ---------- Motion ---------- */

@keyframes qa-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes qa-breathe {
  0%, 100% { opacity: 0.35; transform: scale(0.96); }
  50% { opacity: 0.6; transform: scale(1.04); }
}

@keyframes qa-twinkle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(90deg) scale(0.88); }
}

@keyframes qa-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes qa-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes qa-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-5px); opacity: 1; }
}

@keyframes qa-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -150% 0; }
}

@keyframes qa-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(139, 92, 246, 0); }
}

@keyframes qa-morph {
  0%, 100% { border-radius: 46% 54% 52% 48% / 52% 44% 56% 48%; transform: rotate(0deg) scale(1); }
  33% { border-radius: 58% 42% 40% 60% / 44% 58% 42% 56%; transform: rotate(120deg) scale(1.05); }
  66% { border-radius: 40% 60% 58% 42% / 60% 40% 60% 40%; transform: rotate(240deg) scale(0.96); }
}

@keyframes qa-ring {
  from { opacity: 0.6; transform: scale(0.85); }
  to { opacity: 0; transform: scale(1.35); }
}

@keyframes qa-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #qa-root *,
  #qa-root *::before,
  #qa-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
