:root {
  --help-ink: #102f3d;
  --help-muted: #5a7380;
  --help-navy: #123a56;
  --help-teal: #0c6b6b;
  --help-paper: #f4f8f8;
  --help-line: #c5d5dc;
}

.clinicom-help {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--help-ink);
}

.clinicom-help-toggle {
  border: 0;
  border-radius: 999px;
  min-width: 52px;
  min-height: 52px;
  padding: 0 18px;
  background: var(--help-navy);
  color: #fff;
  font-weight: 650;
  font-size: 0.95rem;
  box-shadow: 0 14px 34px rgba(16, 47, 61, 0.22);
  cursor: pointer;
}

.clinicom-help-toggle:hover,
.clinicom-help-toggle:focus-visible {
  background: #0c2f45;
  outline: 2px solid rgba(12, 107, 107, 0.45);
  outline-offset: 2px;
}

.clinicom-help-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(400px, calc(100vw - 28px));
  height: min(85vh, 680px);
  max-height: min(85vh, 680px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  box-shadow: 0 22px 50px rgba(16, 47, 61, 0.18);
  overflow: hidden;
}

.clinicom-help-panel[hidden] { display: none !important; }

.clinicom-help-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, #eef6f5, #fff);
  border-bottom: 1px solid var(--help-line);
}

.clinicom-help-header strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.05rem;
}

.clinicom-help-header p {
  margin: 4px 0 0;
  color: var(--help-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.clinicom-help-header a {
  color: var(--help-teal);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.clinicom-help-close {
  border: 0;
  background: transparent;
  color: var(--help-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.clinicom-help-log {
  flex: 1;
  overflow: auto;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  background: var(--help-paper);
}

.clinicom-help-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.clinicom-help-msg[data-role="user"] {
  justify-self: end;
  background: var(--help-navy);
  color: #fff;
}

.clinicom-help-msg[data-role="assistant"] {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--help-line);
}

.clinicom-help-msg[data-mode="refuse"] {
  border-color: rgba(176, 88, 42, 0.35);
  background: #fff8f3;
}

.clinicom-help-meta {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--help-muted);
}

.clinicom-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.clinicom-help-links a {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--help-line);
  color: var(--help-teal);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
}

.clinicom-help-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--help-line);
  background: #fff;
}

.clinicom-help-form input {
  width: 100%;
  border: 1px solid var(--help-line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.clinicom-help-form button {
  border: 0;
  border-radius: 12px;
  background: var(--help-teal);
  color: #fff;
  font-weight: 650;
  padding: 0 14px;
  cursor: pointer;
}

.clinicom-help-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 640px) {
  .clinicom-help { right: 12px; bottom: 12px; }
  .clinicom-help-panel {
    bottom: 58px;
    height: min(78vh, 620px);
    max-height: min(78vh, 620px);
    width: min(400px, calc(100vw - 24px));
  }
}
