.featmind-ai-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: #0f172a;
  max-width: 960px;
  margin: 32px auto;
  padding: 0 16px;
}

.fm2-shell {
  background: radial-gradient(circle at top left, rgba(56,189,248,0.12), transparent 55%),
              radial-gradient(circle at bottom right, rgba(129,140,248,0.12), transparent 55%);
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,0.5);
  box-shadow:
    0 18px 40px rgba(15,23,42,0.18),
    0 0 0 1px rgba(255,255,255,0.4) inset;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.fm2-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(148,163,184,0.35);
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(15,23,42,0.92));
  color: #e5e7eb;
}

.fm2-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.fm2-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fm2-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #4ade80, #22c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #022c22;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.8), 0 10px 25px rgba(34,197,94,0.45);
  font-size: 17px;
  flex-shrink: 0;
}

.fm2-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fm2-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.fm2-subtitle {
  font-size: 12px;
  color: #9ca3af;
}

.fm2-header-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fm2-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.7);
  color: #e5e7eb;
  white-space: nowrap;
}

.fm2-pill-soft {
  background: rgba(148,163,184,0.2);
  border-color: rgba(148,163,184,0.8);
}

.fm2-wallet-strip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

.fm2-wallet-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
}

.fm2-wallet-label {
  color: #cbd5f5;
}

.fm2-wallet-value {
  font-weight: 600;
  color: #fefce8;
}

.fm2-wallet-note {
  font-size: 11px;
  color: #9ca3af;
}

.fm2-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fm2-header-btn {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.9);
  padding: 5px 11px;
  font-size: 11px;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  cursor: pointer;
}

.fm2-header-btn-ghost {
  background: transparent;
}

.fm2-body {
  display: flex;
  flex-direction: column;
  height: clamp(520px, 70vh, 720px);
  background: rgba(15,23,42,0.02);
}

.fm2-chat {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fm2-message {
  display: flex;
  gap: 10px;
  max-width: 90%;
}

.fm2-message-user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.fm2-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.fm2-avatar-assistant {
  background: #0f172a;
  color: #e5e7eb;
}

.fm2-avatar-user {
  background: #e0f2fe;
  color: #0f172a;
}

.fm2-bubble {
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 10px 20px rgba(15,23,42,0.10);
}

.fm2-message-assistant .fm2-bubble {
  background: #f9fafb;
  border: 1px solid rgba(148,163,184,0.6);
}

.fm2-message-user .fm2-bubble {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 16px 16px 4px 16px;
}

.fm2-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  color: #6b7280;
}

.fm2-message-user .fm2-name {
  color: #cbd5f5;
  text-align: right;
}

.fm2-text p {
  margin: 0 0 4px;
}

.fm2-text p:last-child {
  margin-bottom: 0;
}

.fm2-footer {
  border-top: 1px solid rgba(148,163,184,0.3);
  padding: 10px 16px 14px;
  background: rgba(248,250,252,0.9);
  backdrop-filter: blur(10px);
}

.fm2-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: white;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.8);
  padding: 4px 4px 4px 14px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
}

.fm2-input {
  flex: 1;
  border: none;
  resize: none;
  font-size: 14px;
  padding: 8px 0;
  outline: none;
  max-height: 120px;
  background: transparent;
}

.fm2-send-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 12px 22px rgba(34,197,94,0.45);
}

.fm2-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #6b7280;
  text-align: left;
}

/* Modal */
.fm2-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.fm2-modal {
  background: #f9fafb;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,0.6);
  box-shadow: 0 22px 40px rgba(15,23,42,0.45);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
}

.fm2-modal-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(148,163,184,0.4);
  background: linear-gradient(135deg, #0f172a, #020617);
  color: #e5e7eb;
}

.fm2-modal-title {
  font-size: 15px;
  font-weight: 600;
}

.fm2-modal-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
}

.fm2-modal-body {
  padding: 14px 18px 10px;
}

.fm2-modal-note {
  font-size: 12px;
  color: #4b5563;
  margin: 0 0 10px;
}

.fm2-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fm2-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}

.fm2-label {
  font-weight: 500;
  color: #374151;
}

.fm2-control {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.9);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  background: white;
}

.fm2-modal-footer {
  padding: 8px 18px 12px;
  border-top: 1px solid rgba(148,163,184,0.3);
  background: #f3f4f6;
  font-size: 11px;
  color: #6b7280;
}

@media (max-width: 768px) {
  .featmind-ai-root {
    margin: 20px auto;
    padding: 0 10px;
  }
  .fm2-shell {
    border-radius: 18px;
  }
  .fm2-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .fm2-header-right {
    align-items: flex-start;
  }
  .fm2-chat {
    padding: 14px 12px;
  }
  .fm2-message {
    max-width: 100%;
  }
}

/* Rounded chat bubbles like WhatsApp */
.fmde-msg-bubble {
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.fmde-msg-user .fmde-msg-bubble {
  background: #1d4ed8;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.fmde-msg-assistant .fmde-msg-bubble {
  background: #f1f5f9;
  color: #111827;
  border-bottom-left-radius: 4px;
}

/* Typing dots speed */
.fmde-typing span {
  animation-duration: 0.7s;
}

/* Composer layout with voice button */
.fmde-composer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fmde-voice-btn {
  border: none;
  background: #e5e7eb;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fmde-voice-btn.fmde-voice-active {
  background: #1d4ed8;
  color: #ffffff;
}

/* Scroll-to-top button inside bubble */
.fmde-scroll-top {
  position: absolute;
  right: 10px;
  bottom: 56px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #e5e7eb;
  color: #111827;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Profile nudge near bubble */
.fmde-profile-nudge {
  position: fixed;
  right: 80px;
  bottom: 80px;
  max-width: 260px;
  background: #111827;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  z-index: 9999;
}
