/* Floating chat / feedback widget — included on every page */
.chat-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 100;
  width: 56px; height: 56px; border-radius: 50%;
  background: #0EA5E9; color: white; border: 0; cursor: pointer;
  font-size: 22px;
  box-shadow: 0 10px 24px -8px rgba(14,165,233,.6);
  transition: transform .15s ease, background .15s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}
.chat-fab:hover { background: #0369A1; transform: translateY(-1px); }
.chat-panel {
  position: fixed; right: 16px; bottom: 84px; z-index: 100;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100dvh - 120px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 25px 60px -15px rgba(0,0,0,.35);
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: #222;
}
.chat-panel[hidden] { display: none; }
.chat-header {
  padding: 12px 14px;
  background: #0EA5E9;
  color: white;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header strong { font-size: 14px; letter-spacing: .3px; flex: 1; text-align: center; }
.chat-back {
  background: transparent; border: 0; color: white; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.chat-back:hover { background: rgba(255,255,255,.15); }
.chat-back[hidden] { display: none; }
.chat-close {
  background: transparent; border: 0; color: white; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.chat-close:hover { background: rgba(255,255,255,.15); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 14px;
  background: #f7f4ee;
}
.chat-msg { display: flex; }
.chat-msg .bubble {
  background: white;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 80%;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  line-height: 1.4;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user .bubble { background: #0EA5E9; color: white; }
.chat-msg.system .bubble { background: #efe6d4; color: #5e4d22; font-size: 13px; font-style: italic; }
/* Mode chooser (first screen of the chat panel) */
.chat-modes {
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f7f4ee;
  overflow-y: auto;
  flex: 1;
}
.chat-modes[hidden] { display: none; }
.chat-modes-intro {
  margin: 0 0 4px;
  font-size: 14px; color: #555; font-weight: 600;
}
.chat-mode {
  appearance: none; cursor: pointer;
  background: white;
  border: 1px solid #e1ddcd;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  font-family: inherit;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.chat-mode:hover:not([disabled]) {
  border-color: #0EA5E9;
  box-shadow: 0 4px 12px -6px rgba(14,165,233,.4);
}
.chat-mode:active:not([disabled]) { transform: scale(.99); }
.chat-mode[disabled] { opacity: .5; cursor: not-allowed; }
.chat-mode-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.chat-mode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-mode-text strong { font-size: 14px; color: #222; font-weight: 700; }
.chat-mode-text small { font-size: 12px; color: #6b7280; line-height: 1.35; }
.chat-conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-conv[hidden] { display: none; }
.chat-form {
  display: grid; gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid #eee;
  background: white;
}
.chat-email { font-size: 13px; padding: 8px 10px; border: 1px solid #e1ddcd; border-radius: 8px; background: #fafaf6; font-family: inherit; }
.chat-row { display: flex; gap: 6px; }
.chat-input {
  flex: 1; font-size: 14px; padding: 10px 12px; border: 1px solid #d6d2c4; border-radius: 8px; background: white;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.chat-form { display: flex; flex-direction: column; gap: 6px; }
.chat-send {
  appearance: none; cursor: pointer; border: 0;
  background: #0EA5E9; color: white;
  padding: 0 14px; font-weight: 700; font-size: 14px;
  border-radius: 8px; min-width: 64px;
  font-family: inherit;
}
.chat-send:hover { background: #0369A1; }

.chat-msg.typing .bubble { background: white; padding: 10px 14px; }
.chat-msg.typing .dot {
  display: inline-block; font-size: 8px; color: #9aa9b6; line-height: 1; margin: 0 1px;
  animation: typingdots 1.2s infinite ease-in-out;
}
.chat-msg.typing .dot:nth-child(2) { animation-delay: .15s; }
.chat-msg.typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingdots {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
