/* Young Eleven chat widget. Uses tokens from site.css (falls back to literals). */
.chat { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 90; font-family: var(--font-sans, system-ui, sans-serif); }
.chat [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.chat-launch {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; background: var(--persimmon-600, #c9441e); color: #fff; cursor: pointer;
  font: 600 15px/1 var(--font-sans, system-ui, sans-serif); white-space: nowrap;
  box-shadow: 0 14px 30px -10px rgba(228, 87, 46, .7), 0 2px 6px rgba(7, 46, 34, .2);
  transition: transform .2s var(--ease, ease), background-color .2s;
}
.chat-launch:hover { background: var(--persimmon-700, #a83716); transform: translateY(-2px); }
.chat-launch svg { flex: none; }
.chat-badge {
  position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--green-800, #0b3e2f); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; border: 2px solid #fff;
}
.chat.is-open .chat-launch { display: none; }

.chat-panel {
  position: absolute; right: 0; bottom: 0; width: 380px; height: min(620px, calc(100dvh - 32px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--cream, #fffdf8); border: 1px solid var(--color-border, #e6dccb); border-radius: 20px;
  box-shadow: 0 30px 70px -20px rgba(7, 46, 34, .45), 0 4px 12px rgba(7, 46, 34, .08);
  transform-origin: bottom right; animation: chat-in .22s var(--ease, ease);
}
@keyframes chat-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 14px 16px; background: var(--green-800, #0b3e2f); color: #fff; }
.chat-avatar { width: 52px; height: auto; flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }
.chat-head-text { min-width: 0; flex: 1; }
.chat-head h2 { font: 600 16px/1.2 var(--font-sans, system-ui, sans-serif); margin: 0; }
.chat-head p { display: flex; align-items: center; gap: 6px; margin: 3px 0 0; font-size: 12px; color: rgba(255, 255, 255, .72); }
.chat-online { width: 8px; height: 8px; border-radius: 50%; background: #5ed39a; flex: none; }
.chat-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px; background: transparent; color: #fff; cursor: pointer; flex: none; }
.chat-x:hover { background: rgba(255, 255, 255, .1); }

.chat-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.msg { flex: none; display: flex; flex-direction: column; max-width: 86%; margin-top: 8px; }
.msg-cont { margin-top: 0; }
.msg-me { align-self: flex-end; align-items: flex-end; }
.msg-bot, .msg-admin { align-self: flex-start; }
.msg-who { font-size: 12px; font-weight: 600; color: var(--ink-muted, #56645d); margin: 0 4px 4px; }
.msg-admin .msg-who { color: var(--persimmon-600, #c9441e); }
.msg-bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere;
  background: #fff; border: 1px solid var(--color-border, #e6dccb); color: var(--ink, #1f2d27);
}
.msg-bot .msg-bubble { border-top-left-radius: 6px; }
.msg-admin .msg-bubble { border-top-left-radius: 6px; background: #fff3ea; border-color: #f6cdb2; }
.msg-me .msg-bubble { background: var(--green-800, #0b3e2f); color: #fff; border-color: transparent; border-top-right-radius: 6px; }
.msg-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.msg-time { font-size: 11px; color: #8a948f; margin: 3px 6px 0; }
.msg-cont .msg-time { display: none; }
.msg-typing .msg-bubble { display: inline-flex; gap: 4px; padding: 14px; }
.msg-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9aa59f; animation: chat-dot 1s infinite ease-in-out; }
.msg-typing i:nth-child(2) { animation-delay: .15s; }
.msg-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chips { flex: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--green-800, #0b3e2f); background: transparent;
  color: var(--green-800, #0b3e2f); font: 600 14px/1 var(--font-sans, system-ui, sans-serif); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.chip:hover { background: var(--green-800, #0b3e2f); color: #fff; }

.chat-contact { flex: none; margin: 10px 0 6px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--color-border, #e6dccb); box-shadow: 0 2px 8px rgba(7, 46, 34, .06); }
.chat-contact-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--green-800, #0b3e2f); }
.chat-contact form { display: grid; gap: 8px; }
.chat-contact input {
  width: 100%; min-height: 44px; padding: 10px 12px; font: 16px/1.3 var(--font-sans, system-ui, sans-serif);
  border: 1.5px solid var(--color-border, #e6dccb); border-radius: 10px; background: var(--cream, #fffdf8); color: var(--ink, #1f2d27);
}
.chat-contact input:focus { outline: none; border-color: var(--green-600, #1d5f4a); box-shadow: 0 0 0 3px rgba(29, 95, 74, .18); }
.chat-contact input[aria-invalid="true"] { border-color: #b42318; }
.chat-contact-actions { display: flex; justify-content: flex-end; gap: 12px; }
.chat-btn, .chat-btn-ghost { min-height: 44px; padding: 0 18px; border-radius: 999px; font: 600 14px/1 var(--font-sans, system-ui, sans-serif); cursor: pointer; white-space: nowrap; }
.chat-btn { border: 0; background: var(--persimmon-600, #c9441e); color: #fff; }
.chat-btn:hover { background: var(--persimmon-700, #a83716); }
.chat-btn:disabled { opacity: .6; }
.chat-btn-ghost { border: 0; background: transparent; color: var(--ink-muted, #56645d); }
.chat-btn-ghost:hover { background: var(--cream-200, #f6f0e4); }

.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--color-border, #e6dccb); background: #fff; }
.chat-compose textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 120px; resize: none; overflow-y: hidden; padding: 11px 14px;
  font: 16px/1.4 var(--font-sans, system-ui, sans-serif); color: var(--ink, #1f2d27);
  border: 1.5px solid var(--color-border, #e6dccb); border-radius: 22px; background: var(--cream, #fffdf8);
}
.chat-compose textarea:focus { outline: none; border-color: var(--green-600, #1d5f4a); box-shadow: 0 0 0 3px rgba(29, 95, 74, .18); }
.chat-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--persimmon-600, #c9441e); color: #fff; cursor: pointer; }
.chat-send:hover { background: var(--persimmon-700, #a83716); }
.chat-send:disabled { opacity: .55; cursor: progress; }
.chat-foot { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11px; color: #8a948f; text-align: center; }

@media (max-width: 599px) {
  .chat-launch-label { display: none; }
  .chat-launch { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .chat-launch svg { width: 24px; height: 24px; }
  .chat.is-open { inset: 0; right: 0; bottom: 0; }
  .chat-panel { position: fixed; inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .chat-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .chat-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  html.chat-locked, html.chat-locked body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel { animation: none; }
  .msg-typing i { animation: none; }
}
