/* support-widget.css — site-wide floating support widget
   (SUPPORT_CHAT_INTEGRATION.md §2, 2026-07-15). Self-contained, cvw- prefixed,
   reads the same tokens every public page already loads. Bottom-LEFT on every
   surface — bottom-right belongs to the property page's Virtual Host pill
   (DD-1), and one uniform rule beats a per-page exception. */

.cvw-launcher {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 900;
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: var(--color-accent, #7a1f3d);
  color: var(--color-text-on-accent, #fff);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.12);
}
.cvw-launcher:hover { background: var(--color-accent-hover, #691a34); }
.cvw-launcher:focus-visible { outline: 3px solid var(--color-focus-ring, #7a1f3d); outline-offset: 2px; }

.cvw-panel {
  position: fixed;
  left: 16px;
  bottom: 76px;
  z-index: 901;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  background: var(--color-surface-1, #fff);
  color: var(--color-text, #1a1a1f);
  border: 1px solid var(--color-border, #e3e0d8);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14), 0 16px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .cvw-panel { transition: opacity 140ms ease, transform 140ms ease; }
  .cvw-panel[hidden] { display: none; }
}

.cvw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border, #e3e0d8);
}
.cvw-title { margin: 0; font-size: 1rem; font-weight: 700; }
.cvw-close {
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px -8px 0;
  border: none;
  background: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text-muted, #666);
  border-radius: 8px;
}
.cvw-close:focus-visible { outline: 3px solid var(--color-focus-ring, #7a1f3d); outline-offset: -2px; }

.cvw-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.cvw-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cvw-msg-bot { align-self: flex-start; background: var(--color-surface-2, #f4f1ea); border-bottom-left-radius: 4px; }
.cvw-msg-visitor { align-self: flex-end; background: var(--color-accent, #7a1f3d); color: var(--color-text-on-accent, #fff); border-bottom-right-radius: 4px; }
/* Token-aware with the old light hexes as fallbacks — on dark (obsidian)
   pages the hardcoded light-pink box was a theme break (critic 2026-07-16). */
.cvw-msg-err { align-self: flex-start; background: var(--color-error-tint, #fdecea); color: var(--color-error-text, #8c1d18); border: 1px solid var(--color-error-text, #f5c6c2); border-bottom-left-radius: 4px; }

.cvw-form { display: flex; gap: 8px; padding: 10px 14px 6px; }
.cvw-form input {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--color-border, #ccc9c0);
  border-radius: 10px;
  background: var(--color-surface-1, #fff);
  color: inherit;
}
.cvw-form button {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-accent, #7a1f3d);
  color: var(--color-text-on-accent, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cvw-form button:disabled { opacity: 0.6; cursor: default; }

.cvw-human {
  display: block;
  padding: 8px 14px 12px;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-text-muted, #666);
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
  min-height: 44px;
}
.cvw-human:focus-visible { outline: 3px solid var(--color-focus-ring, #7a1f3d); outline-offset: -2px; }

/* Escalation form */
.cvw-escalate { padding: 14px; overflow-y: auto; }
.cvw-escalate p { margin: 0 0 10px; font-size: 0.9rem; }
.cvw-field { margin-bottom: 10px; }
.cvw-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.cvw-field input, .cvw-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--color-border, #ccc9c0);
  border-radius: 10px;
  background: var(--color-surface-1, #fff);
  color: inherit;
}
.cvw-field textarea { min-height: 88px; resize: vertical; }
.cvw-escalate-actions { display: flex; gap: 8px; align-items: center; }
.cvw-escalate-actions button[type="submit"] {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-accent, #7a1f3d);
  color: var(--color-text-on-accent, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cvw-escalate-actions button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.cvw-back {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-text-muted, #666);
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
}
.cvw-status { min-height: 1.2em; font-size: 0.85rem; color: #8c1d18; margin: 8px 0 0; }
.cvw-done { padding: 20px 14px; }
.cvw-done h3 { margin: 0 0 8px; font-size: 1rem; }
.cvw-done p { margin: 0 0 8px; font-size: 0.9rem; }

@media (max-width: 480px) {
  .cvw-panel { bottom: 72px; }
  .cvw-launcher span.cvw-launcher-text { display: none; }
  .cvw-launcher { padding: 0 14px; }
}

/* Follow-up form inside the done state (hub-native tickets, doc v2) */
.cvw-done .cvw-form { padding: 12px 0 0; }
