/* Santek-Assistent (unten rechts) – nutzt die Tokens aus site.css */
.sa { --sa-gap: max(16px, env(safe-area-inset-right, 0px)); --sa-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.sa[hidden], .sa-panel[hidden] { display: none !important; }

.sa-launch { position: fixed; right: var(--sa-gap); bottom: var(--sa-bottom); z-index: 45; display: inline-flex; align-items: center; gap: .6em;
  min-height: 52px; padding: 7px 18px 7px 7px; border: 1px solid #30353b; border-radius: 999px; background: var(--anth-900); color: #fff;
  font: 600 .95rem/1 var(--sans); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18), 0 18px 36px -18px rgba(0,0,0,.6);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), opacity .2s; }
.sa-launch:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.2), 0 22px 40px -18px rgba(0,0,0,.7); }
.sa-launch-ic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; flex-shrink: 0; }
.sa-launch-ic svg { display: block; }
.sa-unread { position: absolute; top: 4px; left: 36px; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.sa-open .sa-launch { opacity: 0; pointer-events: none; transform: translateY(8px); }
body.nav-open .sa-launch, body.sa-typing .sa-launch { opacity: 0; pointer-events: none; }

.sa-panel { position: fixed; right: var(--sa-gap); bottom: var(--sa-bottom); z-index: 60; width: min(400px, calc(100vw - 2 * var(--sa-gap)));
  height: min(620px, calc(100vh - var(--header-h) - 40px)); height: min(620px, calc(100dvh - var(--header-h) - 40px));
  height: var(--sa-h, min(620px, calc(100dvh - var(--header-h) - 40px))); max-height: 620px;
  display: flex; flex-direction: column; background: #fff; color: #141619; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid rgba(12,13,15,.08); box-shadow: 0 2px 6px rgba(12,13,15,.12), 0 34px 70px -24px rgba(12,13,15,.55);
  animation: sa-in .28s var(--ease); font-size: .95rem; line-height: 1.55; }
@keyframes sa-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.sa-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; background: var(--anth-900); color: #fff; flex-shrink: 0; }
.sa-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; flex-shrink: 0; }
.sa-titles { flex: 1; min-width: 0; }
.sa-title { margin: 0; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.sa-sub { margin: 1px 0 0; font-size: .75rem; color: #a0a7ae; line-height: 1.3; }
.sa-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: #d2d6da; cursor: pointer; }
.sa-icon-btn:hover { background: var(--anth-700); color: #fff; }

.sa-log { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; background: var(--grey-100); display: flex; flex-direction: column; gap: 10px; }
.sa-log:focus-visible { outline-offset: -3px; }
.sa-msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; overflow-wrap: anywhere; }
.sa-msg p { margin: 0 0 .55em; }
.sa-msg p:last-child, .sa-msg ul:last-child, .sa-msg ol:last-child { margin-bottom: 0; }
.sa-msg ul, .sa-msg ol { margin: 0 0 .55em; padding-left: 1.25em; }
.sa-msg li { margin: .15em 0; }
.sa-msg strong { font-weight: 650; }
.sa-msg a { color: inherit; font-weight: 600; }
.sa-bot { align-self: flex-start; background: #fff; border: 1px solid var(--grey-200); border-bottom-left-radius: 6px; }
.sa-user { align-self: flex-end; background: var(--anth-800); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.sa-user a { color: #fff; }
.sa-msg.sa-error { background: #fff4f3; border-color: #f3c7c3; }
.sa-typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.sa-typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: #8a9197; animation: sa-dot 1.2s infinite ease-in-out; }
.sa-typing-dots i:nth-child(2) { animation-delay: .15s; } .sa-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sa-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.sa-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; background: var(--grey-100); flex-shrink: 0; }
.sa-chips:empty { display: none; }
.sa-chip { border: 1px solid var(--line-strong); background: #fff; color: #1d2024; border-radius: 999px; padding: 6px 12px; font: 550 .84rem/1.3 var(--sans); cursor: pointer; text-align: left; }
.sa-chip:hover { border-color: var(--anth-900); background: var(--anth-900); color: #fff; }
.sa-chip-action { border-color: var(--accent); color: var(--accent); }
.sa-chip-action:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.sa-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--grey-200); background: #fff; flex-shrink: 0; }
.sa-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px;
  font: 400 16px/1.4 var(--sans); color: #141619; background: #fff; }
.sa-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.sa-send { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; cursor: pointer; flex-shrink: 0; }
.sa-send:disabled { opacity: .5; cursor: default; }
.sa-note { margin: 0; padding: 0 14px 10px; background: #fff; font-size: .72rem; line-height: 1.4; color: #5f666d; flex-shrink: 0; }
.sa-note a { color: inherit; }

/* Smartphone: kompaktes Symbol, Fenster als Blatt von unten – die Kopfzeile bleibt sichtbar */
@media (max-width: 640px) {
  .sa { --sa-gap: max(12px, env(safe-area-inset-right, 0px)); --sa-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .sa-launch { padding: 6px; min-height: 0; }
  .sa-launch-ic { width: 44px; height: 44px; }
  .sa-launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sa-unread { left: auto; right: 4px; }
  .sa-panel { left: 8px; right: 8px; bottom: calc(8px + var(--sa-kb, 0px)); width: auto; border-radius: 18px;
    height: calc(100vh - var(--header-h) - 20px); height: var(--sa-h, calc(100dvh - var(--header-h) - 20px)); max-height: 680px; }
  .sa-msg { max-width: 92%; }
  /* genug Platz unter dem letzten Inhalt, damit das Symbol nichts verdeckt */
  body.has-assistant .footer-bottom { padding-bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .sa-panel { animation: none; }
  .sa-launch, .sa-launch:hover { transition: none; transform: none; }
  .sa-typing-dots i { animation: none; opacity: .7; }
}
@media print { .sa { display: none !important; } }
