.erp-help-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 72;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 14px 7px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.erp-help-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .24);
}
.erp-help-launcher.erp-help-suppressed {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
}
.erp-help-launcher-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), var(--violet));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.erp-help-launcher-copy {
  display: grid;
  text-align: left;
  line-height: 1.15;
}
.erp-help-launcher-copy b {
  font-size: 12.5px;
}
.erp-help-launcher-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.erp-help-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 73;
  width: min(420px, calc(100vw - 28px));
  height: min(680px, calc(100dvh - 16px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 19px 0 0 0;
  border-right: 0;
  border-bottom: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  animation: erpHelpIn 180ms ease both;
}
.erp-help-panel[hidden] {
  display: none !important;
}
@keyframes erpHelpIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.erp-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.erp-help-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.erp-help-title-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 800;
}
.erp-help-title b,
.erp-help-title small {
  display: block;
}
.erp-help-title b {
  font-size: 14px;
}
.erp-help-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}
.erp-help-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
}
.erp-help-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 8%, transparent), transparent 44%),
    var(--surface);
}
.erp-help-welcome {
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  font-size: 12px;
  line-height: 1.55;
}
.erp-help-welcome b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.erp-help-message {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}
.erp-help-message.user {
  justify-items: end;
}
.erp-help-message-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.erp-help-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.erp-help-message.user .erp-help-bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.erp-help-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
}
.erp-help-open:hover {
  text-decoration: underline;
}
.erp-help-related {
  display: grid;
  gap: 5px;
  width: 100%;
  margin-top: 7px;
}
.erp-help-related button {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  text-align: left;
  font-size: 11px;
}
.erp-help-related button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.erp-help-actions,
.erp-help-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.erp-help-actions button,
.erp-help-sources a {
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.erp-help-sources a { color: var(--text-2); }
.erp-help-actions button:hover,
.erp-help-sources a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.erp-help-suggestions {
  display: flex;
  gap: 6px;
  padding: 9px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  scrollbar-width: none;
}
.erp-help-suggestions::-webkit-scrollbar {
  display: none;
}
.erp-help-suggestions button {
  flex: none;
  max-width: 240px;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.erp-help-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.erp-help-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.erp-help-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}
.erp-help-form textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}
.erp-help-send {
  align-self: stretch;
  min-width: 66px;
  padding: 8px 11px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 750;
}
.erp-help-send:disabled {
  opacity: .55;
  cursor: wait;
}
.erp-help-foot {
  padding: 0 12px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}
.erp-help-options {
  display: grid;
  gap: 3px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}
.erp-help-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}
.erp-help-typing {
  display: inline-flex;
  gap: 4px;
  padding: 9px 12px;
}
.erp-help-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: erpHelpDot 900ms infinite alternate;
}
.erp-help-typing span:nth-child(2) { animation-delay: 180ms; }
.erp-help-typing span:nth-child(3) { animation-delay: 360ms; }
@keyframes erpHelpDot { to { opacity: .28; transform: translateY(-2px); } }

@media (max-width: 620px) {
  .erp-help-launcher {
    right: 12px;
    bottom: 12px;
    min-height: 44px;
    padding: 5px;
    border-radius: 14px;
  }
  .erp-help-launcher-copy {
    display: none;
  }
  .erp-help-launcher-mark {
    width: 32px;
    height: 32px;
  }
  .erp-help-panel {
    inset: auto 0 0;
    width: 100%;
    height: min(82dvh, 680px);
    border-radius: 17px 0 0 0;
  }
}

@media print {
  .erp-help-launcher,
  .erp-help-panel {
    display: none !important;
  }
}
