/* Chat widget on the customer website: a round button, and a panel above it. */
#cb-fab {
  position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 50;
  display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; padding: 0;
  color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 50%; box-shadow: var(--shadow-3); cursor: pointer;
}
#cb-fab:hover { background: var(--accent-hover); }
#cb-fab svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#cb-panel {
  position: fixed; right: var(--space-5); bottom: 6rem; z-index: 50; display: none; flex-direction: column; overflow: hidden;
  width: 22.5rem; max-width: calc(100vw - 2rem); height: 30rem; max-height: calc(100dvh - 8rem);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
}
#cb-panel.open { display: flex; }
#cb-head { padding: var(--space-3) var(--space-4); font-weight: 700; color: var(--accent-fg); background: var(--accent); }
#cb-log { flex: 1; overflow: auto; padding: var(--space-4); background: var(--bg); }
.msg { max-width: 85%; margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); white-space: pre-wrap; overflow-wrap: anywhere; border-radius: var(--radius-lg); }
.msg.user { margin-left: auto; color: var(--accent-fg); background: var(--accent); }
.msg.bot { color: var(--text); background: var(--surface-sunken); border: 1px solid var(--border); }
#cb-form { display: flex; border-top: 1px solid var(--border); background: var(--surface); }
#cb-text { flex: 1; min-width: 0; border: 0; border-radius: 0; outline-offset: -2px; background: transparent; }
#cb-form button { padding: 0 var(--space-4); font-weight: 700; color: var(--accent-text); background: none; border: 0; cursor: pointer; font-size: var(--text-md); }
#cb-form button:hover { text-decoration: underline; }

@media (max-width: 640px) {
  #cb-fab { right: var(--space-3); bottom: var(--space-3); }
  #cb-panel { right: var(--space-2); bottom: 5rem; width: calc(100vw - 1rem); max-width: none; }
}
