.ai-help-shell {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.18);
}

.ai-help-drawer {
  width: min(600px, calc(100vw - 4rem));
  height: 80vh;
  max-height: calc(100vh - 12em);
  min-height: min(34em, calc(100vh - 12em));
  margin-top: 8em;
  margin-right: 1rem;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid silver;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.ai-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  color: #fff;
  background: var(--pralana_green);
}

.ai-help-title {
  font-size: 1rem;
  font-weight: 400;
}

.ai-help-header .user-manual-link {
  color: #fff;
}

.ai-help-header .um-help-button:hover .user-manual-icon-wrap::after {
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.ai-help-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.ai-help-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 0.9rem;
}

.ai-help-icon-button:hover,
.ai-help-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.ai-help-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 1rem;
}

.ai-help-error:not(:empty) {
  padding: 0.65rem 1rem;
  border-bottom: var(--site_status_error_border_color);
  color: var(--site_status_error_color);
  background: var(--site_status_error_background);
  font-size: 0.8em;
  font-weight: 400;
  line-height: 1.3;
}

.ai-help-error:empty {
  display: none;
}

.ai-help-status-message {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid silver;
  color: var(--text-light);
  background: var(--pralana_background_green);
  font-size: 0.85em;
  font-weight: 400;
  line-height: normal;
}

.ai-help-status-message:empty {
  display: none;
}

.ai-help-status-message ul {
  margin-bottom: 0;
}

.ai-help-messages {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 1rem;
  background: #f7f7f7;
}

.ai-help-empty {
  color: #3d3d3d;
  font-size: 0.9rem;
}

.ai-help-message {
  max-width: 95%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  background: var(--page_background_color);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

.ai-help-pending:empty {
  display: none;
}

.ai-help-message p {
  margin-bottom: 0.25rem;
}
.ai-help-message strong {
  font-weight: 600;
}

.ai-help-message.user {
  margin-left: auto;
  color: #fff;
  border-color: var(--pralana_green);
  background: var(--pralana_green);
}

.ai-help-message.error {
  border-color: #b00020;
  background: #fff4f4;
}

.ai-help-sources {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.ai-help-sources summary {
  cursor: pointer;
  color: var(--pralana_green_darker);
  font-weight: 600;
}

.ai-help-source-list {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

.ai-help-source-section {
  margin-top: 0.5rem;
}

.ai-help-source-section-title {
  color: #3d3d3d;
  font-size: 0.8rem;
  font-weight: 600;
}

.ai-help-source-list li {
  margin-bottom: 0.5rem;
}

.ai-help-source-meta {
  color: #555;
  font-size: 0.78rem;
}

.ai-help-source-path {
  color: #555;
  font-size: 0.78rem;
}

.ai-help-source-score {
  color: #555;
  font-size: 0.78rem;
  font-weight: 500;
}

.ai-help-source-page-name {
  color: #555;
  font-size: 0.82rem;
  font-weight: 600;
}

.ai-help-source-link {
  color: var(--pralana_green_darker);
  text-decoration: underline;
}

.ai-help-form {
  padding: 0.75rem;
  border-top: 1px solid #d8d8d8;
  background: #fff;
}

.ai-help-question {
  width: 100%;
  min-height: 5rem;
  max-height: 11rem;
  resize: vertical;
  padding: 0.5rem;
  border: 1px solid silver;
  border-radius: 5px;
  font-size: 0.9rem;
}

.ai-help-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.ai-help-indicator {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid #b7d9c4;
  border-radius: 999px;
  color: #1f5f3a;
  background: #e8f4ed;
  font-size: 0.9rem;
  font-weight: 700;
}

.htmx-request .ai-help-indicator,
.ai-help-indicator.htmx-request {
  display: inline-flex;
}

.ai-help-indicator.ai-help-indicator-inline {
  display: inline-flex;
}

.ai-help-quota {
  color: #555;
  font-size: 0.85rem;
  white-space: nowrap;
}

.ai-help-quota.exhausted {
  color: #9b1c1c;
  font-weight: 600;
}

.ai-help-submit {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.35rem;
  border: 1px solid var(--pralana_green);
  border-radius: 5px;
  padding: 0.22rem 0.5rem;
  color: #fff;
  background: var(--pralana_green);
  font-size: 0.82rem;
  font-weight: 600;
}

.ai-help-submit i {
  font-size: 0.75rem;
}

.ai-help-submit:hover {
  background: var(--pralana_green_darker);
}

.ai-help-submit:disabled {
  cursor: not-allowed;
  border-color: #a8a8a8;
  color: #f1f1f1;
  background: #9a9a9a;
}

.ai-help-submit:disabled:hover {
  background: #9a9a9a;
}

.ai-help-feedback {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.65rem;
  color: #555;
  font-size: 0.8rem;
}

.ai-help-feedback-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  color: #3d3d3d;
  background: #fff;
}

.ai-help-feedback-button:hover {
  border-color: #a9a9a9;
  background: #f2f2f2;
}

.ai-help-feedback-button.helpful.active {
  color: #215b37;
  border-color: #b8e3c8;
  background: #e6f6ec;
}

.ai-help-feedback-button.not-helpful.active {
  color: #7a1f26;
  border-color: #f0b8bf;
  background: #fdebed;
}

.ai-help-feedback-saved {
  color: var(--pralana_green_darker);
  font-weight: 600;
}

.ai-help-history {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-help-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #3d3d3d;
  font-size: 0.85rem;
  font-weight: 600;
}

.ai-help-history-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--pralana_green_lighter);
  border-radius: 6px;
  color: #2d2d2d;
  background: #fff;
}

.ai-help-history-item:hover {
  border-color: var(--pralana_green);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.ai-help-history-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-help-history-open {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.ai-help-history-delete-form {
  margin: 0;
}

.ai-help-history-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 0;
  padding: 0;
  background: transparent;
}

.ai-help-history-delete:focus > img.img-inside-button,
.ai-help-history-delete:hover > img.img-inside-button {
  border-radius: 50%;
  box-shadow: 0 0 8px var(--site_status_error_color);
}

.ai-help-history-meta,
.ai-help-history-answer {
  display: block;
  color: var(--text-light);
  font-size: 0.8rem;
}
.ai-help-history-answer p {
  margin: 0;
}
.ai-help-history-answer strong {
  font-weight: 600;
}
.ai-help-history-question {
  display: block;
  padding: 0.1rem 0.4rem;
  margin: 0.3rem 0 0.25rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--pralana_background_green);

}

@media (max-width: 640px) {
  .ai-help-drawer {
    width: 100vw;
    height: calc(100vh - 6em);
    min-height: 0;
    margin-top: 3em;
    margin-right: 0;
    border-radius: 4px;
  }
}
