/*
 * AI Content Chatbot - Widget
 * Gleiche Formensprache wie das florianmatthias-Chat-Widget.
 * Alle Regeln sind auf .aicb-widget-shell gescoped und setzen Eigenschaften
 * explizit, damit WordPress-Themes nicht in die Darstellung hineinregieren.
 */

.aicb-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000000;
  padding: 10px 14px;
  background: #fff;
  color: #111;
  transform: translateY(-200%);
}

.aicb-skip-link:focus {
  transform: none;
  outline: 3px solid currentColor;
}

.aicb-widget-shell,
.aicb-widget-shell *,
.aicb-widget-shell *::before,
.aicb-widget-shell *::after {
  box-sizing: border-box;
}

.aicb-widget-shell {
  /* Farben - werden vom Plugin als Inline-Variablen überschrieben */
  --aicb-accent: #8c8875;
  --aicb-accent-strong: #756f5f;
  --aicb-status-dot: #4f8a5b;
  --aicb-launcher-bg: #736b5b;
  --aicb-bg: #f9f6f1;
  --aicb-panel: #ffffff;
  --aicb-text: #2f2a24;
  --aicb-avatar-bg: #f1ece3;
  --aicb-avatar-fg: #5f5748;
  --aicb-user-bubble: #ece5da;
  --aicb-bot-bubble: #ffffff;
  --aicb-composer-bg: #ffffff;
  --aicb-composer-border: #e8e2d8;
  --aicb-composer-button-bg: #5f5748;
  --aicb-composer-button-text: #f8f6f1;

  /* Abgeleitete Töne: Fallback in Grau, sonst aus der Textfarbe gemischt */
  --aicb-hairline: rgba(47, 42, 36, 0.12);
  --aicb-hairline-soft: rgba(47, 42, 36, 0.09);
  --aicb-hover-soft: rgba(47, 42, 36, 0.06);
  --aicb-chip-border: rgba(47, 42, 36, 0.28);
  --aicb-muted: rgba(47, 42, 36, 0.55);
  --aicb-soft: rgba(47, 42, 36, 0.75);
  --aicb-idle-bg: rgba(47, 42, 36, 0.1);
  --aicb-idle-fg: rgba(47, 42, 36, 0.5);

  --aicb-radius-lg: 18px;
  --aicb-radius-md: 14px;
  --aicb-radius-sm: 10px;
  --aicb-pill-height: 44px;

  color: var(--aicb-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  z-index: 999999;
}

@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .aicb-widget-shell {
    --aicb-hairline: color-mix(in srgb, var(--aicb-text) 12%, transparent);
    --aicb-hairline-soft: color-mix(in srgb, var(--aicb-text) 9%, transparent);
    --aicb-hover-soft: color-mix(in srgb, var(--aicb-text) 6%, transparent);
    --aicb-chip-border: color-mix(in srgb, var(--aicb-text) 28%, transparent);
    --aicb-muted: color-mix(in srgb, var(--aicb-text) 55%, transparent);
    --aicb-soft: color-mix(in srgb, var(--aicb-text) 75%, transparent);
    --aicb-idle-bg: color-mix(in srgb, var(--aicb-text) 10%, transparent);
    --aicb-idle-fg: color-mix(in srgb, var(--aicb-text) 50%, transparent);
  }
}

.aicb-widget-shell.aicb-mode-floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
}

.aicb-widget-shell.aicb-mode-inline {
  position: relative;
  width: min(100%, 420px);
}

/* --- Launcher und Begrüßungs-Popup -------------------------------------- */
.aicb-widget-shell .aicb-launcher {
  width: 60px;
  height: 60px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: var(--aicb-launcher-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 14px 34px rgba(17, 16, 13, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aicb-widget-shell .aicb-launcher:hover {
  transform: translateY(-1px) scale(1.04);
}

.aicb-widget-shell .aicb-launcher-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-variant-emoji: emoji;
  line-height: 1;
}

.aicb-widget-shell .aicb-launcher-icon.aicb-custom-icon {
  border: 1px solid var(--aicb-hairline);
  border-radius: 50%;
  color: var(--aicb-avatar-fg);
  background: var(--aicb-avatar-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.aicb-widget-shell .aicb-launcher-icon svg {
  width: 68%;
  height: 68%;
  max-width: 44px;
  max-height: 44px;
  display: block;
  margin: auto;
  color: inherit;
  stroke: currentColor;
}

.aicb-widget-shell .aicb-launcher-icon svg[fill="#000000"],
.aicb-widget-shell .aicb-launcher-icon svg [fill="#000000"],
.aicb-widget-shell .aicb-launcher-icon svg[fill="#000"],
.aicb-widget-shell .aicb-launcher-icon svg [fill="#000"],
.aicb-widget-shell .aicb-launcher-icon svg[fill="black"],
.aicb-widget-shell .aicb-launcher-icon svg [fill="black"],
.aicb-widget-shell .aicb-avatar svg[fill="#000000"],
.aicb-widget-shell .aicb-avatar svg [fill="#000000"],
.aicb-widget-shell .aicb-avatar svg[fill="#000"],
.aicb-widget-shell .aicb-avatar svg [fill="#000"],
.aicb-widget-shell .aicb-avatar svg[fill="black"],
.aicb-widget-shell .aicb-avatar svg [fill="black"],
.aicb-widget-shell .aicb-row-avatar svg[fill="#000000"],
.aicb-widget-shell .aicb-row-avatar svg [fill="#000000"],
.aicb-widget-shell .aicb-row-avatar svg[fill="#000"],
.aicb-widget-shell .aicb-row-avatar svg [fill="#000"],
.aicb-widget-shell .aicb-row-avatar svg[fill="black"],
.aicb-widget-shell .aicb-row-avatar svg [fill="black"] {
  fill: currentColor;
}

.aicb-widget-shell .aicb-launcher-icon svg[stroke="#000000"],
.aicb-widget-shell .aicb-launcher-icon svg [stroke="#000000"],
.aicb-widget-shell .aicb-launcher-icon svg[stroke="#000"],
.aicb-widget-shell .aicb-launcher-icon svg [stroke="#000"],
.aicb-widget-shell .aicb-launcher-icon svg[stroke="black"],
.aicb-widget-shell .aicb-launcher-icon svg [stroke="black"],
.aicb-widget-shell .aicb-avatar svg[stroke="#000000"],
.aicb-widget-shell .aicb-avatar svg [stroke="#000000"],
.aicb-widget-shell .aicb-avatar svg[stroke="#000"],
.aicb-widget-shell .aicb-avatar svg [stroke="#000"],
.aicb-widget-shell .aicb-avatar svg[stroke="black"],
.aicb-widget-shell .aicb-avatar svg [stroke="black"],
.aicb-widget-shell .aicb-row-avatar svg[stroke="#000000"],
.aicb-widget-shell .aicb-row-avatar svg [stroke="#000000"],
.aicb-widget-shell .aicb-row-avatar svg[stroke="#000"],
.aicb-widget-shell .aicb-row-avatar svg [stroke="#000"],
.aicb-widget-shell .aicb-row-avatar svg[stroke="black"],
.aicb-widget-shell .aicb-row-avatar svg [stroke="black"] {
  stroke: currentColor;
}

.aicb-widget-shell.aicb-open .aicb-launcher {
  display: none;
}

.aicb-widget-shell .aicb-teaser {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: none;
  align-items: flex-start;
  gap: 12px;
  width: max-content;
  max-width: 280px;
  padding: 14px 16px;
  border: 1px solid var(--aicb-hairline);
  border-radius: var(--aicb-radius-lg);
  background: var(--aicb-panel);
  color: var(--aicb-text);
  box-shadow: 0 18px 40px rgba(17, 16, 13, 0.16);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
}

.aicb-widget-shell .aicb-teaser.aicb-teaser-visible {
  display: flex;
}

.aicb-widget-shell .aicb-teaser-content {
  display: block;
  min-width: 0;
}

/* Fragen-Popup: keine Box - die Vorschlaege stehen als frei schwebende Pills
   rechtsbuendig ueber der Seite; das X als kleiner runder Button darueber.
   pointer-events: none laesst die Luecken zwischen den Pills auf die Seite
   durchklicken (Pills + X setzen pointer-events wieder auf auto). */
.aicb-widget-shell .aicb-teaser.aicb-teaser-questions {
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 8px;
  width: min(320px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.aicb-widget-shell .aicb-teaser.aicb-teaser-questions .aicb-teaser-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.aicb-widget-shell .aicb-teaser-question {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 7px 18px;
  border: 1px solid var(--aicb-chip-border);
  border-radius: 999px;
  background: var(--aicb-panel);
  color: var(--aicb-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: end;
  text-wrap: balance;
  box-shadow: 0 6px 18px rgba(17, 16, 13, 0.12);
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

/* Touch-Ziel, ohne die Pille optisch aufzublaesen */
.aicb-widget-shell .aicb-teaser-question::after {
  content: "";
  position: absolute;
  inset: -6px 0;
}

/* Zweizeilige Pills: weicherer Radius statt Wurst-Kapsel (Klasse per JS) */
.aicb-widget-shell .aicb-teaser-question.aicb-pill-wrapped {
  border-radius: 14px;
}

.aicb-widget-shell .aicb-teaser-question:hover {
  border-color: var(--aicb-text);
  background: var(--aicb-panel);
  transform: none;
}

/* X im Fragen-Popup: eigener kleiner runder Button, da die Box wegfaellt */
.aicb-widget-shell .aicb-teaser.aicb-teaser-questions .aicb-teaser-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--aicb-hairline);
  border-radius: 50%;
  background: var(--aicb-panel);
  color: var(--aicb-muted);
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(17, 16, 13, 0.12);
  pointer-events: auto;
}

.aicb-widget-shell .aicb-teaser.aicb-teaser-questions .aicb-teaser-close:hover {
  color: var(--aicb-text);
  border-color: var(--aicb-chip-border);
}

/* Lead-Zeile im Fragen-Popup ausblenden - die Pills sprechen fuer sich */
.aicb-widget-shell .aicb-teaser.aicb-teaser-questions .aicb-teaser-lead {
  display: none;
}

.aicb-widget-shell.aicb-open .aicb-teaser {
  display: none;
}

.aicb-widget-shell .aicb-teaser-close {
  position: relative;
  flex-shrink: 0;
  margin-block: -2px 0;
  margin-inline: 0 -4px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--aicb-muted);
  font-size: 18px;
  line-height: 1.1;
  cursor: pointer;
}

/* Trefferflaeche des kleinen X auf ~40px vergroessern, ohne die Pille aufzublaesen. */
.aicb-widget-shell .aicb-teaser-close::after {
  content: "";
  position: absolute;
  inset: -12px;
}

.aicb-widget-shell .aicb-teaser-close:hover {
  color: var(--aicb-text);
}

/* --- Panel ---------------------------------------------------------------- */
.aicb-widget-shell .aicb-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: calc(100vw - 28px);
  height: min(660px, calc(100vh - 60px));
  min-height: min(460px, calc(100dvh - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--aicb-hairline-soft);
  border-radius: 20px;
  overflow: hidden;
  background: var(--aicb-panel);
  box-shadow: 0 24px 60px rgba(17, 16, 13, 0.2);
}

/* display: grid schlägt sonst das hidden-Attribut - Panel bliebe immer offen */
.aicb-widget-shell .aicb-panel[hidden] {
  display: none;
}

.aicb-widget-shell.aicb-mode-inline .aicb-panel {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: none;
  height: 620px;
  box-shadow: 0 8px 30px rgba(17, 16, 13, 0.1);
}

/* --- Kopfzeile ------------------------------------------------------------ */
.aicb-widget-shell .aicb-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 14px;
  padding-inline: 16px 14px;
  background: var(--aicb-panel);
  border-bottom: 1px solid var(--aicb-hairline);
}

.aicb-widget-shell .aicb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--aicb-hairline);
  background: var(--aicb-avatar-bg);
  color: var(--aicb-avatar-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 1px 2px rgba(17, 16, 13, 0.06);
  font-size: 18px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-variant-emoji: emoji;
  line-height: 1;
}

.aicb-widget-shell .aicb-avatar svg {
  width: 24px;
  height: 24px;
  display: block;
  color: inherit;
  stroke: currentColor;
}

.aicb-widget-shell .aicb-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.aicb-widget-shell .aicb-title {
  margin: 0;
  padding: 0;
  color: var(--aicb-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aicb-widget-shell .aicb-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  color: var(--aicb-muted);
  font-size: 12px;
  line-height: 1.2;
}

.aicb-widget-shell .aicb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--aicb-status-dot);
}

.aicb-widget-shell .aicb-header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.aicb-widget-shell .aicb-icon-btn {
  width: 32px;
  height: 32px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--aicb-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.aicb-widget-shell .aicb-icon-btn:hover {
  background: var(--aicb-hover-soft);
  color: var(--aicb-text);
}

.aicb-widget-shell .aicb-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Verlauf -------------------------------------------------------------- */
.aicb-widget-shell .aicb-messages {
  position: relative;
  overflow-y: auto;
  padding: 18px 16px 22px;
  background: var(--aicb-bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--aicb-hairline) transparent;
}

.aicb-widget-shell .aicb-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;
}

.aicb-widget-shell .aicb-typing-status:empty {
  display: none;
}

.aicb-widget-shell .aicb-messages::-webkit-scrollbar {
  width: 6px;
}

.aicb-widget-shell .aicb-messages::-webkit-scrollbar-track {
  background: transparent;
}

.aicb-widget-shell .aicb-messages::-webkit-scrollbar-thumb {
  background: var(--aicb-hairline);
  border-radius: 999px;
}

.aicb-widget-shell .aicb-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aicb-widget-shell .aicb-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}

.aicb-widget-shell .aicb-row.aicb-user {
  justify-content: flex-end;
}

.aicb-widget-shell .aicb-row-avatar {
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--aicb-hairline);
  background: var(--aicb-avatar-bg);
  color: var(--aicb-avatar-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 1px 2px rgba(17, 16, 13, 0.05);
  font-size: 15px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-variant-emoji: emoji;
  line-height: 1;
}

.aicb-widget-shell .aicb-row-avatar svg {
  width: 17px;
  height: 17px;
  display: block;
  color: inherit;
  stroke: currentColor;
}

/* Folgenachrichten desselben Absenders: Platz halten, Avatar ausblenden */
.aicb-widget-shell .aicb-row.aicb-stacked .aicb-row-avatar {
  visibility: hidden;
}

.aicb-widget-shell .aicb-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.aicb-widget-shell .aicb-row.aicb-user .aicb-stack {
  flex: 0 1 auto;
  align-items: flex-end;
  max-width: 85%;
}

.aicb-widget-shell .aicb-bubble {
  max-width: 100%;
  width: fit-content;
  margin: 0;
  padding: 12px 15px;
  border: 1px solid var(--aicb-hairline-soft);
  border-radius: var(--aicb-radius-lg);
  background: var(--aicb-bot-bubble);
  color: var(--aicb-text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(17, 16, 13, 0.04);
}

.aicb-widget-shell .aicb-row.aicb-user .aicb-bubble {
  background: var(--aicb-user-bubble);
  border-color: transparent;
  box-shadow: none;
}

.aicb-widget-shell .aicb-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.aicb-widget-shell .aicb-bubble strong {
  font-weight: 700;
}

.aicb-widget-shell .aicb-bubble ul {
  margin: 0.4em 0;
  padding-inline-start: 1.5em;
  list-style: disc outside;
}

.aicb-widget-shell .aicb-bubble em {
  font-style: italic;
}

.aicb-widget-shell .aicb-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--aicb-hover-soft);
}

.aicb-widget-shell .aicb-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aicb-widget-shell .aicb-source-ref {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--aicb-hairline-soft);
  border-radius: 999px;
  background: var(--aicb-hover-soft);
  color: var(--aicb-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  vertical-align: middle;
  white-space: normal;
}

.aicb-widget-shell .aicb-bubble a.aicb-source-ref {
  color: var(--aicb-soft);
  text-decoration: none;
}

.aicb-widget-shell .aicb-source-ref:hover {
  border-color: var(--aicb-accent-strong);
  color: var(--aicb-text);
  text-decoration: none;
}

.aicb-widget-shell .aicb-source-inline {
  margin-inline: 2px;
}

.aicb-widget-shell .aicb-source-ref span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aicb-widget-shell .aicb-source-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Tipp-Indikator */
.aicb-widget-shell .aicb-bubble.aicb-typing {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--aicb-muted);
  font-size: 13px;
}

.aicb-widget-shell .aicb-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.aicb-widget-shell .aicb-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: aicbTyping 1.2s infinite ease-in-out;
}

.aicb-widget-shell .aicb-typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.aicb-widget-shell .aicb-typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes aicbTyping {
  0%,
  60%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  30% {
    opacity: 0.85;
    transform: translateY(-2px);
  }
}

/* --- Startansicht: Themen ------------------------------------------------- */
.aicb-widget-shell .aicb-topics {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  margin-top: 10px;
}

.aicb-widget-shell .aicb-topics-label {
  margin-bottom: 2px;
  padding-inline-start: 2px;
  color: var(--aicb-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.aicb-widget-shell .aicb-topics-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.aicb-widget-shell .aicb-topic-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid var(--aicb-hairline);
  border-radius: 999px;
  background: var(--aicb-bot-bubble);
  color: var(--aicb-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: start;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(17, 16, 13, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.aicb-widget-shell .aicb-topic-row:hover {
  border-color: var(--aicb-accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 16, 13, 0.1);
}

.aicb-widget-shell .aicb-topic-row.aicb-highlight {
  border-color: var(--aicb-accent-strong);
  box-shadow: 0 8px 20px rgba(17, 16, 13, 0.1);
}

/* KI-generierte, seitenbezogene Fragen: dezent akzentuiert */
.aicb-widget-shell .aicb-topic-row.aicb-topic-ai {
  background: var(--aicb-bot-bubble);
  border-color: var(--aicb-hairline);
}

.aicb-widget-shell .aicb-topic-row.aicb-topic-ai .aicb-chevron {
  display: none;
}

/* Lead-Zeile im Fragen-Teaser */
.aicb-widget-shell .aicb-teaser-lead {
  margin: 0 0 2px;
  padding-inline-start: 2px;
  color: var(--aicb-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.aicb-widget-shell .aicb-chevron {
  display: none;
  width: 0;
  height: 0;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.4;
}

/* --- Karten und Aktionen -------------------------------------------------- */
.aicb-widget-shell .aicb-card {
  position: relative;
  width: min(100%, 320px);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--aicb-hairline);
  border-radius: var(--aicb-radius-lg);
  background: var(--aicb-panel);
  color: var(--aicb-text);
  box-shadow: none;
  transition: border-color 0.15s ease;
}

/* Ganze Card klickbar (stretched link ueber den Titel-Anker); Rahmen dunkelt
   auf Hover. :has() ist Progressive Enhancement - ohne :has bleibt die Card
   trotzdem klickbar und der Titel unterstreicht sich (::after deckt die Card). */
.aicb-widget-shell .aicb-card:has(a.aicb-card-title):hover {
  border-color: var(--aicb-text);
}

.aicb-widget-shell .aicb-card:has(a.aicb-card-title:focus-visible) {
  outline: 2px solid var(--aicb-text);
  outline-offset: 2px;
}

.aicb-widget-shell .aicb-card-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--aicb-radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(135deg, rgba(140, 136, 117, 0.14) 0 9px, rgba(140, 136, 117, 0.04) 9px 18px),
    var(--aicb-bg);
}

.aicb-widget-shell .aicb-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.aicb-widget-shell .aicb-card-body {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: center;
}

.aicb-widget-shell .aicb-card-title {
  color: var(--aicb-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* Titel-Link: animierte Unterstreichung (currentColor, palette-agnostisch) und
   zugleich die Klickflaeche der ganzen Card. Kein position:relative am Anker,
   damit das ::after gegen die (relative) .aicb-card aufspannt. */
.aicb-widget-shell a.aicb-card-title {
  align-self: start;
  justify-self: start;
  max-width: 100%;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 100% 100%;
  background-repeat: no-repeat;
  transition: background-size 0.2s ease;
}

.aicb-widget-shell a.aicb-card-title::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* Hover ueber irgendeinen Teil der Card = Hover auf dem card-deckenden ::after
   des Titels -> Linie laeuft ein (funktioniert auch ohne :has). */
.aicb-widget-shell a.aicb-card-title:hover,
.aicb-widget-shell a.aicb-card-title:focus-visible {
  text-decoration: none;
  background-size: 100% 1px;
  background-position: 0 100%;
}

.aicb-widget-shell .aicb-card-desc {
  margin: 0;
  color: var(--aicb-soft);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail-Tags (graue Flaeche unter der Beschreibung) entfallen im Redesign -
   die Card zeigt nur Thumb, Titel und max. 2 Zeilen Beschreibung. */
.aicb-widget-shell .aicb-details {
  display: none;
}

.aicb-widget-shell .aicb-detail {
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--aicb-bg);
  color: var(--aicb-soft);
  font-size: 10.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.aicb-widget-shell .aicb-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, 330px);
}

.aicb-widget-shell .aicb-link-actions + .aicb-question-actions {
  margin-top: 8px;
}

.aicb-widget-shell .aicb-question-actions {
  padding-top: 2px;
}

.aicb-widget-shell .aicb-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  max-width: 100%;
  height: var(--aicb-pill-height);
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--aicb-hairline-soft);
  border-radius: 999px;
  background: var(--aicb-panel);
  color: var(--aicb-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(17, 16, 13, 0.04);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.aicb-widget-shell .aicb-action span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aicb-widget-shell .aicb-link-actions .aicb-action.aicb-primary {
  border-color: transparent;
  background: var(--aicb-composer-button-bg);
  color: var(--aicb-composer-button-text);
}

.aicb-widget-shell .aicb-action:hover {
  transform: translateY(-1px);
  border-color: var(--aicb-accent-strong);
}

.aicb-widget-shell .aicb-action-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Eingabe und Fußzeile ------------------------------------------------ */
.aicb-widget-shell .aicb-composer-area {
  background: var(--aicb-panel);
  border-top: 1px solid var(--aicb-hairline);
}

.aicb-widget-shell .aicb-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 14px 8px;
  padding-block: 6px;
  padding-inline: 15px 6px;
  border: 1px solid var(--aicb-composer-border);
  border-radius: 22px;
  background: var(--aicb-composer-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aicb-widget-shell .aicb-composer:focus-within {
  border-color: var(--aicb-accent-strong);
  box-shadow: 0 0 0 3px var(--aicb-hover-soft);
}

.aicb-widget-shell .aicb-composer textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-height: 120px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--aicb-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
  box-shadow: none;
}

.aicb-widget-shell .aicb-composer textarea:focus {
  /* Theme focus styles often use !important; the rounded composer owns focus. */
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.aicb-widget-shell .aicb-composer textarea::placeholder {
  color: var(--aicb-muted);
  opacity: 1;
}

.aicb-widget-shell .aicb-send {
  width: 38px;
  height: 38px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--aicb-composer-button-bg);
  color: var(--aicb-composer-button-text);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.aicb-widget-shell .aicb-send:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* Leeres Eingabefeld: Button tritt optisch zurück */
.aicb-widget-shell .aicb-send.aicb-idle {
  background: var(--aicb-idle-bg);
  color: var(--aicb-idle-fg);
}

.aicb-widget-shell .aicb-send:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.aicb-widget-shell .aicb-send svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aicb-widget-shell .aicb-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  padding: 2px 18px 12px;
  color: var(--aicb-muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.aicb-widget-shell .aicb-disclaimer {
  margin: 0;
  padding: 0;
  max-width: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.aicb-widget-shell .aicb-privacy {
  color: inherit;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.aicb-widget-shell .aicb-privacy:hover {
  color: var(--aicb-text);
}

/* Hinweis-Ausblenden (X): kleiner Ghost-Button, Trefferflaeche via ::after
   auf ~40px vergroessert, ohne die Fusszeile optisch zu verschieben. */
.aicb-widget-shell .aicb-footer-dismiss {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--aicb-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.aicb-widget-shell .aicb-footer-dismiss::after {
  content: "";
  position: absolute;
  inset: -11px;
}

.aicb-widget-shell .aicb-footer-dismiss:hover {
  background: var(--aicb-hover-soft);
  color: var(--aicb-text);
}

.aicb-widget-shell .aicb-footer-dismiss svg {
  width: 11px;
  height: 11px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Beenden-Bestaetigung ----------------------------------------------- */
.aicb-widget-shell .aicb-close-confirm[hidden] {
  display: none !important;
}

.aicb-widget-shell .aicb-close-confirm {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-radius: inherit;
}

.aicb-widget-shell .aicb-close-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 42, 36, 0.18);
  backdrop-filter: blur(2px);
}

.aicb-widget-shell .aicb-close-confirm-sheet {
  position: relative;
  display: grid;
  gap: 0;
  width: 100%;
  padding: 20px 18px;
  border-top: 1px solid var(--aicb-hairline);
  border-radius: var(--aicb-radius-lg) var(--aicb-radius-lg) 0 0;
  background: var(--aicb-panel);
  color: var(--aicb-text);
  box-shadow: 0 -18px 46px rgba(17, 16, 13, 0.16);
  text-align: start;
}

/* Titel/Text bewusst als div (kein h2/p): Theme-Ueberschriften-Styles mit hoher
   Spezifitaet oder !important koennen so nicht mehr reinfunken. Alle Werte explizit. */
.aicb-widget-shell .aicb-close-confirm-title {
  margin: 0;
  padding: 0;
  color: var(--aicb-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: normal;
  text-transform: none;
}

.aicb-widget-shell .aicb-close-confirm-message {
  margin: 4px 0 0;
  padding: 0;
  color: var(--aicb-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
}

/* Aktionen als horizontale Pill-Reihe (bricht bei Bedarf um) */
.aicb-widget-shell .aicb-close-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.aicb-widget-shell .aicb-close-confirm-sheet button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid var(--aicb-chip-border);
  border-radius: 999px;
  background: transparent;
  color: var(--aicb-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

/* Destruktiv ("Ja, schließen"): entschaerfter Outline-Button */
.aicb-widget-shell .aicb-close-confirm-end {
  border-color: var(--aicb-chip-border);
  background: transparent;
  color: var(--aicb-text);
}

.aicb-widget-shell .aicb-close-confirm-end:hover {
  border-color: var(--aicb-text);
  background: var(--aicb-hover-soft);
}

/* Sichere Wahl ("Nein, weitermachen"): gefuellter Primaer-Button; Fokus startet hier */
.aicb-widget-shell .aicb-close-confirm-cancel {
  border-color: transparent;
  background: var(--aicb-composer-button-bg);
  color: var(--aicb-composer-button-text);
}

.aicb-widget-shell .aicb-close-confirm-cancel:hover {
  border-color: transparent;
  background: var(--aicb-accent);
}

.aicb-widget-shell .aicb-hidden {
  display: none !important;
}

/* --- Im Hero-Bereich ausblenden ------------------------------------------ */
/* Nur aktiv, wenn im Backend gewaehlt (Klasse aicb-hide-in-hero, serverseitig
   gesetzt). Sobald der Nutzer den Hero verlaesst, setzt das JS aicb-past-hero
   -> Launcher/Teaser poppen weich auf. Ein offenes Panel bleibt immer sichtbar. */
.aicb-widget-shell.aicb-hide-in-hero .aicb-launcher,
.aicb-widget-shell.aicb-hide-in-hero .aicb-teaser {
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease, visibility 0s;
}

.aicb-widget-shell.aicb-hide-in-hero:not(.aicb-past-hero):not(.aicb-open) .aicb-launcher,
.aicb-widget-shell.aicb-hide-in-hero:not(.aicb-past-hero) .aicb-teaser {
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
}

@media (max-width: 520px) {
  .aicb-widget-shell.aicb-mode-floating {
    right: 14px;
    bottom: 14px;
  }

  .aicb-widget-shell .aicb-panel {
    position: fixed;
    inset: 12px;
    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;
  }

  .aicb-widget-shell .aicb-launcher {
    width: 56px;
    height: 56px;
  }

  .aicb-widget-shell .aicb-topic-row {
    font-size: 14px;
    padding: 10px 15px;
  }

  .aicb-widget-shell .aicb-composer textarea {
    /* verhindert Auto-Zoom in iOS Safari */
    font-size: 16px;
  }
}

@media (max-height: 520px) {
  .aicb-widget-shell.aicb-mode-floating .aicb-panel {
    position: fixed;
    inset: 0;
    width: auto;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aicb-widget-shell *,
  .aicb-widget-shell *::before,
  .aicb-widget-shell *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Touch-Ziele --------------------------------------------------------- */
/* Auf Zeigern ohne Praezision (Touch) die gruppierten Bedienelemente auf
   >=44px vergroessern; Abstaende mitwachsen lassen, damit nichts ueberlappt. */
@media (pointer: coarse) {
  .aicb-widget-shell .aicb-header-actions {
    gap: 4px;
  }

  .aicb-widget-shell .aicb-icon-btn {
    width: 44px;
    height: 44px;
  }

  .aicb-widget-shell .aicb-send {
    width: 44px;
    height: 44px;
  }

  .aicb-widget-shell .aicb-feedback {
    gap: 8px;
  }

  .aicb-widget-shell .aicb-feedback-btn {
    width: 36px;
    height: 36px;
  }
}

/* --- Rechts-nach-links (Arabisch, Hebräisch ...) -------------------------- */
.aicb-widget-shell[dir="rtl"].aicb-mode-floating {
  right: auto;
  left: 24px;
}

.aicb-widget-shell[dir="rtl"] .aicb-panel,
.aicb-widget-shell[dir="rtl"] .aicb-teaser {
  right: auto;
  left: 0;
}

.aicb-widget-shell[dir="rtl"] .aicb-chevron {
  transform: scaleX(-1);
}

@media (max-width: 520px) {
  .aicb-widget-shell[dir="rtl"].aicb-mode-floating {
    right: auto;
    left: 14px;
  }
}

@media (max-height: 520px) {
  .aicb-widget-shell[dir="rtl"].aicb-mode-floating .aicb-panel {
    right: 0;
  }
}

/* --- Feedback-Leiste ----------------------------------------------------- */
.aicb-widget-shell .aicb-feedback {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: min(100%, 330px);
  margin-top: 2px;
  margin-inline-start: auto;
}
.aicb-widget-shell .aicb-feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--aicb-muted);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.aicb-widget-shell .aicb-feedback-btn:hover {
  color: var(--aicb-text);
  background: transparent;
  transform: translateY(-1px);
}
.aicb-widget-shell .aicb-feedback-btn:focus-visible {
  outline: 2px solid var(--aicb-accent-strong);
  outline-offset: 2px;
}
.aicb-widget-shell .aicb-feedback-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.aicb-widget-shell .aicb-feedback-btn.aicb-chosen.aicb-feedback-up {
  color: var(--aicb-status-dot, #4f8a5b);
  background: transparent;
}
.aicb-widget-shell .aicb-feedback-btn.aicb-chosen.aicb-feedback-down {
  color: #b23b3b;
  background: transparent;
}
.aicb-widget-shell .aicb-feedback.aicb-voted .aicb-feedback-btn:not(.aicb-chosen) {
  opacity: 0.4;
  pointer-events: none;
}
