/* =====================================================================
   DIA – KI-Chat-Assistentin (Diemer Remake, Screen 2a)
   ===================================================================== */
.dia-root { position: fixed; right: 24px; bottom: 24px; z-index: 99990; font-family: 'Inter', sans-serif; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.dia-root *, .dia-root *::before, .dia-root *::after { box-sizing: border-box; }

/* ---------- Launcher + Teaser ---------- */
.dia-launcher { width: 62px; height: 62px; border-radius: 50%; border: 1px solid #222222 !important; background: linear-gradient(#FFEC00 0%, #F5AD0D 100%) !important; color: #222222; font-weight: 800; font-size: 17px; font-family: 'Inter', sans-serif; display: grid; place-items: center; box-shadow: 0 10px 28px rgba(245,173,13,.4); cursor: pointer; position: relative; transition: transform .15s; }
.dia-launcher:hover { transform: scale(1.06); }
.dia-launcher.dia-hidden { display: none; }
.dia-badge { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #E74C3C; color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 700; }
.dia-teaser { background: #fff; border: 1px solid #E2E8F0; border-radius: 14px 14px 4px 14px; padding: 12px 16px; font-size: 13.5px; line-height: 1.3; color: #33475B; box-shadow: 0 6px 20px rgba(31,62,145,.12); max-width: 230px; cursor: pointer; }

/* ---------- Panel ---------- */
.dia-panel { display: none; width: 400px; max-width: calc(100vw - 32px); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 48px rgba(31,62,145,.22); font-size: 15px; color: #33475B; flex-direction: column; }
.dia-panel.dia-open { display: flex; }

.dia-head { background: linear-gradient(135deg, #1F3E91, #0A5BA8 160%); color: #fff; padding: 18px 20px; display: flex; gap: 12px; align-items: center; }
.dia-avatar-wrap { position: relative; flex: 0 0 auto; }
.dia-avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, #E8820C, #D07407); display: grid; place-items: center; font-weight: 800; font-size: 14px; box-shadow: 0 3px 10px rgba(232,130,12,.35); }
.dia-online { position: absolute; bottom: 0; right: 0; width: 11px; height: 11px; border-radius: 50%; background: #2ECC71; border: 2px solid #1F3E91; box-shadow: 0 0 0 0 rgba(46,204,113,.6); animation: dia-pulse 2.2s ease-out infinite; }
@keyframes dia-pulse { 0% { box-shadow: 0 0 0 0 rgba(46,204,113,.55); } 70% { box-shadow: 0 0 0 6px rgba(46,204,113,0); } 100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); } }
.dia-head-text { flex: 1; min-width: 0; }
.dia-head-title { font-weight: 700; font-size: 16px; }
.dia-head-sub { font-size: 12.5px; color: #B8C9D9; }
.dia-close { width: 30px; height: 30px; border-radius: 8px; border: 0 !important; display: grid; place-items: center; background: rgba(255,255,255,.12) !important; cursor: pointer; font-size: 14px; color: #fff; font-family: inherit; }
.dia-close:hover { background: rgba(255,255,255,.22); }
.dia-reset { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 0 !important; display: grid; place-items: center; background: rgba(255,255,255,.14) !important; cursor: pointer; color: #fff; transition: background .15s, transform .2s; }
.dia-reset:hover { background: rgba(255,255,255,.24) !important; }
.dia-reset:active svg { transform: rotate(-70deg); }
.dia-reset svg { width: 17px; height: 17px; transition: transform .35s; }

.dia-body { height: 470px; max-height: min(60vh, 470px); overflow-y: auto; background: #F4F7FA; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.dia-body::-webkit-scrollbar { width: 8px; }
.dia-body::-webkit-scrollbar-thumb { background: #D4DEE7; border-radius: 99px; }
.dia-body::-webkit-scrollbar-track { background: transparent; }

/* ---------- Nachrichten ---------- */
.dia-row { display: flex; gap: 10px; align-items: flex-end; animation: dia-in .25s ease both; }
.dia-user-row { animation: dia-in .25s ease both; }
@keyframes dia-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.dia-mini { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #1F3E91, #0A5BA8); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: 0 0 auto; }
.dia-bubble { padding: 12px 16px; font-size: 14px; line-height: 1.5; }
.dia-bot-bubble { background: #fff; border: 1px solid #E2E8F0; border-radius: 16px 16px 16px 4px; max-width: 280px; box-shadow: 0 1px 3px rgba(31,62,145,.05); }
.dia-user-row { display: flex; justify-content: flex-end; }
.dia-user-bubble { background: linear-gradient(135deg, #0A5BA8, #1F3E91); color: #fff; border-radius: 16px 16px 4px 16px; max-width: 270px; box-shadow: 0 2px 8px rgba(10,91,168,.18); }
.dia-dots { color: #8FA3B5; font-size: 12px; letter-spacing: 2px; padding: 14px 16px; }

/* ---------- Chips ---------- */
.dia-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 0 38px; }
.dia-chip { display: inline-flex; align-items: center; gap: 7px; background: #fff !important; border: 1.5px solid #D4DEE7 !important; color: #1F3E91 !important; font-weight: 600; font-size: 13px; padding: 8px 15px 8px 10px; border-radius: 99px; cursor: pointer; font-family: 'Inter', sans-serif; transition: border-color .15s, box-shadow .15s, transform .15s; }
.dia-chip:hover { border-color: #0A5BA8 !important; box-shadow: 0 4px 14px rgba(10,91,168,.14); transform: translateY(-1px); }
.dia-chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #EAF2FA; font-size: 12px; flex-shrink: 0; }

/* ---------- Lead-Formular ---------- */
.dia-leadform { margin: -4px 0 0 38px; background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 14px; display: grid; gap: 9px; max-width: 280px; }
.dia-leadform input { border: 1px solid #D4DEE7; border-radius: 8px; padding: 11px 12px; font-size: 13.5px; font-family: 'Inter', sans-serif; color: #33475B; }
.dia-leadform input::placeholder { color: #8FA3B5; }
.dia-leadform input:focus { border-color: #0A5BA8; outline: none; }
.dia-leadform button { background: linear-gradient(#FFEC00 0%, #F5AD0D 100%) !important; color: #222222 !important; border: 1px solid #222222 !important; font-weight: 700; font-size: 14px; padding: 12px !important; border-radius: 999px; cursor: pointer; font-family: 'Inter', sans-serif; }
.dia-leadform button:hover { background: linear-gradient(#F5D400 0%, #E09A0B 100%) !important; color: #222222 !important; }
.dia-leadform button:disabled { opacity: .7; cursor: default; }
.dia-error { font-size: 12.5px; color: #D0342C; }

/* ---------- Eingabe + Fußnote ---------- */
.dia-input { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid #E2E8F0; background: #fff; }
.dia-input input { flex: 1; min-width: 0; border: 1px solid #D4DEE7; border-radius: 10px; padding: 12px 14px; font-size: 14px; font-family: 'Inter', sans-serif; color: #33475B; }
.dia-input input::placeholder { color: #8FA3B5; }
.dia-input input:focus { border-color: #0A5BA8; outline: none; }
.dia-input button { width: 44px !important; height: 44px !important; flex: 0 0 auto; border-radius: 999px; background: linear-gradient(#FFEC00 0%, #F5AD0D 100%) !important; color: #222222 !important; border: 1px solid #222222 !important; padding: 0 !important; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, transform .1s; }
.dia-input button:hover { background: linear-gradient(#F5D400 0%, #E09A0B 100%) !important; color: #222222 !important; }
.dia-input button:active { transform: scale(.94); }
.dia-input button svg { width: 19px; height: 19px; display: block; }
.dia-note { text-align: center; font-size: 11px; color: #8FA3B5; padding: 7px 10px 10px; background: #fff; }
.dia-note a { color: #8FA3B5; text-decoration: underline; }

/* ---------- Inline-Modus (eigene Seite /erstgespraech/, kein Bubble mehr) ----------
   Bewusst im "Mainstream-KI-Chat"-Look (wie ChatGPT/Claude): randlos,
   volle Hoehe, mittig fliessende Nachrichtenspalte, Eingabe unten fixiert. */
.dia-root.dia-inline { position: static; display: flex; flex-direction: column; width: 100%; height: 100%; max-width: 100%; margin: 0; }
.dia-root.dia-inline .dia-panel { display: flex; flex-direction: column; width: 100%; max-width: 100%; height: 100%; border: 1px solid #E2E8F0; border-radius: 16px; box-shadow: 0 4px 20px rgba(31,62,145,.06); background: #F7F9FB; overflow: hidden; }
.dia-root.dia-inline .dia-head { background: #fff; color: #1F3E91; border-bottom: 1px solid #E2E8F0; padding: 16px 24px; flex: 0 0 auto; }
.dia-root.dia-inline .dia-avatar { background: #1F3E91; }
.dia-root.dia-inline .dia-online { border-color: #fff; }
.dia-root.dia-inline .dia-head-title { color: #1F3E91; }
.dia-root.dia-inline .dia-head-sub { color: #6B7E90; }
.dia-root.dia-inline .dia-body { flex: 1 1 auto; height: auto; max-height: none; background: transparent; padding: 28px 20px 0; }
.dia-root.dia-inline .dia-body > * { max-width: 820px; width: 100%; margin-left: auto; margin-right: auto; }
.dia-root.dia-inline .dia-bot-bubble, .dia-root.dia-inline .dia-user-bubble { max-width: 68%; }
/* Eingabezeile schwebt als weisse Mini-Karte MIT Schatten in der grauen
   Flaeche, statt als eigener abgesetzter weisser Streifen darunter. */
.dia-root.dia-inline .dia-input { flex: 0 0 auto; max-width: 820px; width: calc(100% - 40px); margin: 16px auto 20px; border: 1px solid #E2E8F0; border-top: 1px solid #E2E8F0; border-radius: 16px; padding: 8px 8px 8px 18px; box-shadow: 0 10px 28px rgba(31,62,145,.10); background: #fff; }
.dia-root.dia-inline .dia-input input { border: 0; padding: 10px 4px; }
.dia-root.dia-inline .dia-input input:focus { outline: none; }
.dia-root.dia-inline .dia-input button { border-radius: 50% !important; width: 42px !important; height: 42px !important; }

/* ---------- Mobil ---------- */
@media (max-width: 767px) {
  .dia-root:not(.dia-inline) { right: 12px; bottom: 88px; }
  .dia-panel { width: calc(100vw - 24px); }
  .dia-body { height: auto; max-height: 55vh; }
  .dia-teaser { display: none; }
  .dia-launcher { width: 54px; height: 54px; font-size: 15px; }
  .dia-root.dia-inline .dia-head { padding: 14px 16px; }
  .dia-root.dia-inline .dia-body { padding: 18px 12px; }
  .dia-root.dia-inline .dia-input { width: calc(100% - 24px); margin-bottom: 14px; }
  .dia-root.dia-inline .dia-bot-bubble, .dia-root.dia-inline .dia-user-bubble { max-width: 84%; }
}
