.ai-help-popup {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1080;
  font-size: 0.95rem;
}

.ai-help-popup__bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(59, 130, 246, 0.38);
  border-radius: 999px;
  padding: 0.78rem 1rem;
  color: #f8fafc;
  background: #0f172a;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  font-weight: 700;
}

.ai-help-popup__bubble:hover,
.ai-help-popup__bubble:focus-visible {
  background: #111c33;
  border-color: rgba(96, 165, 250, 0.7);
}

.ai-help-popup__bubble-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
}

.ai-help-popup__panel {
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 2rem));
  height: min(640px, calc(100vh - 2rem));
  overflow: hidden;
  color: #dbeafe;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.75rem;
  box-shadow: 0 24px 72px rgba(2, 6, 23, 0.45);
}

.ai-help-popup__panel[hidden] {
  display: none;
}

.ai-help-popup__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: #101827;
}

.ai-help-popup__eyebrow {
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-help-popup__header h2 {
  margin: 0.1rem 0 0;
  font-size: 1.05rem;
  line-height: 1.25;
  color: #f8fafc;
}

.ai-help-popup__icon-button {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 0.5rem;
  color: #e2e8f0;
  background: #172033;
  font-size: 1.35rem;
  line-height: 1;
}

.ai-help-popup__icon-button:hover,
.ai-help-popup__icon-button:focus-visible {
  background: #1e293b;
}

.ai-help-popup__notice {
  margin: 0.9rem 1rem 0;
  padding: 0.72rem 0.8rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.55rem;
  font-size: 0.84rem;
}

.ai-help-popup__status {
  margin: 0.75rem 1rem 0;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 700;
}

.ai-help-popup__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
}

.ai-help-popup__message {
  max-width: 92%;
  padding: 0.72rem 0.8rem;
  border-radius: 0.7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.42;
}

.ai-help-popup__message--assistant {
  align-self: flex-start;
  color: #e2e8f0;
  background: #111827;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.ai-help-popup__message--user {
  align-self: flex-end;
  color: #ffffff;
  background: #1d4ed8;
}

.ai-help-popup__meta {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  color: #bfdbfe;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.78rem;
}

.ai-help-popup__meta ul {
  margin: 0.35rem 0 0;
  padding-left: 1.05rem;
}

.ai-help-popup__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.ai-help-popup__links a {
  color: #dbeafe;
  border: 1px solid rgba(96, 165, 250, 0.38);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  text-decoration: none;
  font-size: 0.78rem;
}

.ai-help-popup__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.75rem;
}

.ai-help-popup__quick button,
.ai-help-popup__context {
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 999px;
  color: #dbeafe;
  background: #111827;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.ai-help-popup__quick button:hover,
.ai-help-popup__context:hover,
.ai-help-popup__quick button:focus-visible,
.ai-help-popup__context:focus-visible {
  border-color: rgba(96, 165, 250, 0.7);
  background: #172033;
}

.ai-help-popup__context {
  align-self: flex-start;
  margin: 0 1rem 0.75rem;
}

.ai-help-popup__context[aria-pressed="false"] {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.26);
}

.ai-help-popup__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: #101827;
}

.ai-help-popup__form textarea {
  resize: none;
  min-height: 3.1rem;
  max-height: 8rem;
  color: #e5e7eb;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.55rem;
  padding: 0.55rem 0.65rem;
}

.ai-help-popup__form textarea:focus {
  outline: 0;
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 0.16rem rgba(37, 99, 235, 0.26);
}

.ai-help-popup__form button {
  align-self: end;
  min-width: 5.2rem;
  border: 0;
  border-radius: 0.55rem;
  padding: 0.55rem 0.8rem;
  color: #ffffff;
  background: #2563eb;
  font-weight: 700;
}

.ai-help-popup__form button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .ai-help-popup {
    right: 0.65rem;
    bottom: 0.65rem;
    left: 0.65rem;
  }

  .ai-help-popup__bubble {
    float: right;
  }

  .ai-help-popup__panel {
    width: 100%;
    height: min(88vh, 720px);
    border-radius: 0.75rem 0.75rem 0.55rem 0.55rem;
  }

  .ai-help-popup__form {
    grid-template-columns: 1fr;
  }

  .ai-help-popup__form button {
    width: 100%;
  }
}
