/* ── Forward Margin AI Chat Widget ── */
.fm-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #2D5E1E;
  color: #fff;
  border: 2px solid #C49A2A;
  box-shadow: 0 12px 32px rgba(45, 94, 30, 0.32);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: 'Inter', system-ui, sans-serif;
}
.fm-chat-fab:hover { transform: translateY(-2px) scale(1.04); background: #3A7427; }
.fm-chat-fab svg { width: 28px; height: 28px; }
.fm-chat-fab[aria-expanded='true'] { background: #1A1A1A; }

.fm-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #E0E8D8;
  box-shadow: 0 24px 60px rgba(26, 26, 26, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
}
.fm-chat-panel.open { display: flex; }

.fm-chat-header {
  background: linear-gradient(135deg, #2D5E1E 0%, #1A3810 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.fm-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #C49A2A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #1A1A1A;
  flex-shrink: 0;
}
.fm-chat-header-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.fm-chat-header-title { font-size: 15px; font-weight: 800; line-height: 1.1; }
.fm-chat-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fm-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6BD45F;
  display: inline-block;
}
.fm-chat-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.fm-chat-close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.fm-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  background: #F7F9F5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fm-chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.fm-chat-msg.assistant { background: #fff; border: 1px solid #E0E8D8; color: #1A1A1A; align-self: flex-start; border-top-left-radius: 4px; }
.fm-chat-msg.user { background: #2D5E1E; color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.fm-chat-msg.error { background: #fff5f5; border: 1px solid #f0c9c9; color: #8a2828; align-self: flex-start; border-top-left-radius: 4px; }

.fm-chat-typing { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
.fm-chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #999;
  animation: fm-chat-bounce 1.2s infinite ease-in-out;
}
.fm-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.fm-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fm-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.fm-chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; background: #F7F9F5; }
.fm-chat-suggestion {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid #E0E8D8;
  background: #fff;
  color: #2D5E1E;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.fm-chat-suggestion:hover { background: #2D5E1E; color: #fff; border-color: #2D5E1E; }

.fm-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid #E0E8D8;
  background: #fff;
}
.fm-chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px solid #E0E8D8;
  border-radius: 10px;
  outline: none;
  resize: none;
  max-height: 120px;
  color: #1A1A1A;
}
.fm-chat-input:focus { border-color: #2D5E1E; }
.fm-chat-send {
  background: #C49A2A;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background 0.15s;
}
.fm-chat-send:hover { background: #D4AA3A; }
.fm-chat-send:disabled { background: #ccc; cursor: not-allowed; }

.fm-chat-disclaimer {
  font-size: 10.5px;
  color: #888;
  text-align: center;
  padding: 0 14px 10px;
  background: #fff;
  line-height: 1.4;
}
.fm-chat-disclaimer a { color: #2D5E1E; }

@media (max-width: 480px) {
  .fm-chat-panel { right: 12px; left: 12px; width: auto; bottom: 90px; height: calc(100vh - 120px); }
  .fm-chat-fab { bottom: 16px; right: 16px; }
}
