/*
 * Fondsberater.ai-Widget – 1:1 aus fonds-guenstig.de (V15).
 * Gleiche Maße, Farben, Typografie und Interaktion: Karte 300 × 75 px,
 * Portrait 172 × 292 px, Chatfenster max. 410 px. Position: unten rechts,
 * fest im Viewport; bei geöffnetem Seitenmenü rückt das Widget mit.
 */

.fm-advisor {
  position: fixed;
  right: 14px;
  bottom: 52px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
body.side-open .fm-advisor { right: 352px; }

.fm-launch {
  position: relative;
  display: flex;
  align-items: flex-end;
  text-align: left;
  width: 300px;
  background: linear-gradient(180deg, #f9fbfc, #edf3f5);
  color: #152e38;
  border: 1px solid #c9dcd8;
  border-radius: 12px;
  box-shadow: 0 12px 34px #0005;
  min-height: 75px;
  padding: 12px 135px 12px 14px;
  overflow: visible;
}
.fm-launch:hover { background: linear-gradient(180deg, #fff, #f2f7f7); box-shadow: 0 14px 36px #0006; }
.fm-launch[hidden] { display: none !important; }

.fm-launch-copy { display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; }
.fm-launch-copy small { font-size: 9px; letter-spacing: .12em; font-weight: 800; color: #087d68; }
.fm-launch-copy b { font-size: 15px; font-weight: 760; letter-spacing: -.5px; line-height: 1.2; }
.fm-launch-copy span { font-size: 12px; color: #087d68; font-weight: 700; }
.fm-launch-copy i { font-style: normal; color: #5d7680; font-size: 11px; }

.fm-portrait {
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 172px;
  height: 292px;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px #0e233744);
}
.fm-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom right;
  display: block;
}

.fm-chat {
  width: min(410px, calc(100vw - 35px));
  background: #f8fafb;
  color: #172b38;
  border-radius: 14px;
  border: 1px solid #c7d6da;
  box-shadow: 0 15px 50px #0007;
  overflow: auto;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 110px);
}
.fm-chat[hidden] { display: none !important; }

.fm-chat-head { display: flex; align-items: center; gap: 12px; padding: 13px; background: #edf4f2; border-bottom: 1px solid #d5e2e0; flex: none; }
.fm-chat-avatar { width: 58px; height: 66px; background: #d7e5e3; border-radius: 10px; overflow: hidden; flex: none; display: flex; align-items: flex-end; justify-content: center; }
.fm-chat-avatar img { width: 100%; height: 100%; object-fit: contain; }
.fm-chat-head b { display: block; font-size: 13px; }
.fm-chat-head small { display: block; font-size: 10px; color: #637c82; }
.fm-chat-head button { margin-left: auto; background: none; border: 0; font-size: 22px; color: #5b7178; line-height: 1; }

.fm-messages { padding: 13px; display: flex; flex-direction: column; gap: 8px; overflow: auto; font-size: 12px; max-height: min(260px, 35vh); }
.fm-bubble { background: #e8f0ee; padding: 10px; border-radius: 8px 8px 8px 2px; max-width: 95%; line-height: 1.5; }
.fm-bubble.user { align-self: flex-end; background: #173f45; color: #fff; border-radius: 8px 8px 2px 8px; }
.fm-bubble .up { color: #0d7a5f; font-weight: 700; }
.fm-bubble .down { color: #b6303e; font-weight: 700; }
.fm-bubble .muted { color: #6c8188; }
.fm-suggest { align-self: flex-start; border: 1px solid #bdd4d0; background: #fff; color: #1b6459; border-radius: 6px; padding: 6px 9px; font-size: 11px; text-align: left; }
.fm-suggest:hover { background: #f2faf7; }

.fm-chat form { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #e2ebea; flex: none; }
.fm-chat input { flex: 1; min-width: 0; border: 1px solid #cbd9dc; border-radius: 6px; padding: 9px; font-size: 12px; color: #172b38; background: #fff; }
.fm-chat form button { background: #087d68; color: #fff; border: 0; border-radius: 6px; width: 36px; font-size: 18px; flex: none; }
.fm-chat-note { display: block; color: #72848b; text-align: center; font-size: 10px; padding: 2px 9px 10px; }
.fm-berater-link { display: block; text-align: center; padding: 11px; background: #e2f4ed; border-top: 1px solid #d5e5e0; font-size: 12px; color: #087d68; font-weight: 650; text-decoration: none; }
.fm-berater-link:hover { text-decoration: underline; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .fm-advisor { right: 8px; bottom: 40px; }
  body.side-open .fm-advisor { right: 8px; }
  .fm-launch { width: 218px; min-height: 55px; padding: 9px 85px 9px 10px; border-radius: 12px; }
  .fm-launch-copy b { font-size: 12px; }
  .fm-launch-copy small { font-size: 7px; }
  .fm-launch-copy span, .fm-launch-copy i { font-size: 9px; }
  .fm-portrait { width: 122px; height: 200px; right: -4px; }
  .fm-chat { width: min(335px, calc(100vw - 16px)); }
  .fm-chat-avatar { width: 48px; height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .fm-launch { transition: none; }
}
