#ai-chat-launcher {
    position: fixed;
    right: 15px;
    bottom: 15px;
    width: 76px;
    height: 76px;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-size: 24px;
    background: #f3f3f3;
    border: 5px solid #f3f3f3;
    outline: thin solid #ccc ;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 99990;
    background-image: url('defaultagent.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    overflow: visible;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

#ai-chat-launcher:hover {
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
    transform: scale(1.06);
}

#ai-chat-launcher.ai-chat-launcher-dragging,
#ai-chat-launcher.ai-chat-launcher-dragging:hover {
    cursor: grabbing;
    transform: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

body.ai-chat-launcher-is-dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
}

#ai-chat-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ff5f6d 0%, #e11d48 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.35);
    pointer-events: none;
}

#ai-chat-badge:empty {
    display: none;
}

/* ---------- Chat-Panel ---------- */
#ai-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: min(940px, calc(100vw - 40px));
    height: min(690px, calc(100vh - 120px));
    background: var(--color-highlight);
    border: 1px solid var(--color-highlight);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04);
    display: none;
    overflow: hidden;
    z-index: 99991;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    transition: top 0.2s ease, right 0.2s ease, bottom 0.2s ease, left 0.2s ease,
                width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}

#ai-chat-panel.ai-chat-panel-maximized {
    top: 20px;
    right: 20px;
    bottom: 20px;
    left: 20px;
    width: auto;
    height: auto;
}

/* ---------- Sidebar ---------- */
#ai-chat-sidebar {
    width: 285px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    background: var(--color-highlight);
    overflow: hidden;
}

#ai-chat-sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

#ai-chat-sidebar-header strong {
    color: #e8edf4;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#ai-chat-todo-wrapper {
    padding: 10px 10px 0;
    flex-shrink: 0;
}

#ai-chat-todo-item {
    margin-bottom: 0;
}

#ai-chat-todo-link .conv-title {
    font-weight: 600;
}

#ai-chat-todo-link::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

#ai-chat-todo-item.active #ai-chat-todo-link::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a3a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

/* ---------- Verlauf-Liste ---------- */
#ai-chat-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#ai-chat-conversations::-webkit-scrollbar { width: 4px; }
#ai-chat-conversations::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}

/* Verlauf-Eintrag */
.ai-chat-conversation-item {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: background 0.15s ease;
    position: relative;
}

.ai-chat-conversation-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Aktiver Eintrag: weiße Karte mit blauem linken Rand */
.ai-chat-conversation-item.active {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-left: 3px solid #3b82f6;
}

.ai-chat-conversation-item.active .ai-chat-conversation-select {
    color: #0d1b2a;
}

.ai-chat-conversation-item.active .ai-chat-conversation-select .conv-title {
    color: #0d1b2a;
    font-weight: 600;
}

.ai-chat-conversation-item.active .ai-chat-conversation-select .conv-time {
    color: #64748b;
}

/* Trash-Icon pro Eintrag – erscheint bei Hover */
.ai-chat-conversation-item .conv-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
}

.ai-chat-conversation-item:hover .conv-delete,
.ai-chat-conversation-item.active .conv-delete {
    opacity: 1;
}

.ai-chat-conversation-item .conv-delete::after {
    content: '';
    display: block;
    width: 13px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.ai-chat-conversation-item .conv-delete:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
}

/* Select-Button im Eintrag */
.ai-chat-conversation-select {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 10px 32px 10px 12px; /* rechts Platz für Trash-Icon */
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #a8b8cc;
    line-height: 1.4;
}

/* Chat-Bubble-Icon */
.ai-chat-conversation-select::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7f96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.ai-chat-conversation-item.active .ai-chat-conversation-select::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a3a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

/* Titel + Zeitstempel */
.ai-chat-conversation-select .conv-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.conv-title {
    font-size: 13px;
    color: #a8b8cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.conv-time {
    font-size: 11px;
    color: #5a6f84;
    display: flex;
    align-items: center;
    gap: 3px;
}

.conv-time::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6f84' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

.ai-chat-empty-list {
    padding: 14px 12px;
    color: #6b7f96;
    font-size: 13px;
}

/* ---------- Haupt-Bereich ---------- */
#ai-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f4f6f9;
}

/* ---------- Header (Haupt) ---------- */
#ai-chat-main-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #ffffff;
    flex-shrink: 0;
}

#ai-chat-title {
    font-size: 15px;
    font-weight: 700;
    color: #0d1b2a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

#ai-chat-todo-details {
    display: none;
    margin: 18px 18px 0;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid #fdba74;
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    color: #7c2d12;
    line-height: 1.6;
    box-shadow: 0 8px 24px rgba(124, 45, 18, 0.08);
    max-height: 300px;
    overflow-y: auto;
}

#ai-chat-todo-details a {
    color: #9a3412;
    font-weight: 600;
    text-decoration: underline;
}

#ai-chat-todo-details a:hover {
    color: #7c2d12;
}

/* Trash + X als gemeinsame Button-Gruppe */
.ai-chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* ---------- Nachrichten-Bereich ---------- */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    background: #f4f6f9;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#ai-chat-messages::-webkit-scrollbar { width: 5px; }
#ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ---------- Nachrichten-Zeile (Row) ---------- */
.ai-chat-message-row {
    display: flex;
    align-items: flex-start; /* Avatar oben ausrichten */
    margin-bottom: 16px;
    gap: 10px;
}

/* KI: Avatar links */
.ai-chat-message-row-assistant {
    flex-direction: row;
    justify-content: flex-start;
}

/* Nutzer: User-Icon rechts */
.ai-chat-message-row-user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* ---------- Avatare ---------- */
.ai-chat-avatar,
.ai-chat-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    margin-top: 2px; /* leicht nach unten, damit Avatar auf Höhe der Blase */
}

/* Avatar */
.ai-chat-avatar {
    background-image: url("defaultagent.png");
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center center;
}

.ai-chat-avatar.ai-chat-avatar-anyagent {
    background-image: url("anyagent.png");
    background-size: 90%;
}

/* User-Avatar: graues Person-Icon */
.ai-chat-user-avatar {
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-user-avatar::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* ---------- Nachrichten-Spalte ---------- */
.ai-chat-message-col {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    min-width: 0;
}

.ai-chat-message-row-user .ai-chat-message-col {
    align-items: flex-end;
}

.ai-chat-message-row-assistant .ai-chat-message-col {
    align-items: flex-start;
}

/* ---------- Nachrichten-Blasen ---------- */
.ai-chat-message {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
    max-width: 100%;
    word-break: break-word;
}

/* Nutzer: Navy-Pill */
.ai-chat-message-user {
    background: #1a3a5c;
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 2px 8px rgba(26, 58, 92, 0.3);
}

/* KI: weiße Card mit blauem linken Rand */
.ai-chat-message-assistant {
    background: #ffffff;
    color: #1e293b;
    border-radius: 4px 16px 16px 16px;
    border: 1px solid #dde4ef;
    border-left: 3px solid #3b82f6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

/* ---------- Token-Anzeige: außerhalb der Blase ---------- */
.ai-chat-token-usage {
    margin-top: 5px;
    font-size: 10px;
    line-height: 1.3;
    color: var(--color-highlight);
    letter-spacing: 0.01em;
    padding: 0 2px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ai-chat-token-usage::before {
    content: '';
    display: inline-block;
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8c4d0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* ---------- Links in KI-Antworten als Pill-Button ---------- */
.ai-chat-message-assistant a,
.ai-chat-message-markdown a {
    color: #1a3a5c;
    text-decoration: underline;
}

.ai-chat-message-assistant a::after,
.ai-chat-message-markdown a::after {
}

.ai-chat-message-assistant a:hover,
.ai-chat-message-markdown a:hover {
}

/* ---------- Status-Zeile ---------- */
#ai-chat-status {
    display: none;
    padding: 8px 16px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
    background: #fefce8;
    border-left: 3px solid #f59e0b;
    flex-shrink: 0;
}

/* ---------- Eingabe-Bereich ---------- */
#ai-chat-composer {
    border-top: 1px solid #e2e8f0;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #ffffff;
    flex-shrink: 0;
}

/* [+] Button links */
#ai-chat-attach {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid #dbe4ef;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-size: 0;
    color: transparent;
    overflow: hidden;
    margin-bottom: 4px;
}

#ai-chat-attach::after {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

#ai-chat-attach:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

#ai-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    border: 1.5px solid #dbe4ef;
    padding: 11px 16px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.5;
    box-sizing: border-box;
}

#ai-chat-input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#ai-chat-input::placeholder {
    color: #94a3b8;
}

/* ---------- Buttons (gemeinsam) ---------- */
#ai-chat-send,
#ai-chat-new,
#ai-chat-delete,
#ai-chat-maximize,
#ai-chat-close {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

/* Senden-Button: runder Pfeil-Button */
#ai-chat-send {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    color: transparent;
    overflow: hidden;
    background: var(--color-highlight);
    flex-shrink: 0;
    border: 0;
    margin-bottom: 0;
}

#ai-chat-send::after {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='19' x2='12' y2='5'/%3E%3Cpolyline points='5 12 12 5 19 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

#ai-chat-send:hover { background: var(--color-hover); }
#ai-chat-send:active { transform: scale(0.96); }

/* Neu-Button */
#ai-chat-new {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: #000;
    white-space: nowrap;
    flex-shrink: 0;
    border: 0;
}

#ai-chat-new:hover { background: var(--color-hover); }

/* Löschen-Button: Trash-Icon */
#ai-chat-delete {
    background: transparent;
    color: transparent;
    padding: 0;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0 !important;
    font-size: 0;
    line-height: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

#ai-chat-delete::after {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

#ai-chat-delete:hover {
    border-color: #fca5a5 !important;
    background: #fff5f5;
}

#ai-chat-delete:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
}

/* Maximieren-/Verkleinern-Button */
#ai-chat-maximize {
    background: transparent;
    color: transparent;
    padding: 0;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0 !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

#ai-chat-maximize::after {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='1.5' ry='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

#ai-chat-maximize:hover {
    background: #f1f5f9;
    color: #475569;
}

#ai-chat-maximize:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='1.5' ry='1.5'/%3E%3C/svg%3E");
}

#ai-chat-panel.ai-chat-panel-maximized #ai-chat-maximize::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h10a2 2 0 0 1 2 2v10'/%3E%3Crect x='3' y='9' width='12' height='12' rx='1.5' ry='1.5'/%3E%3C/svg%3E");
}

#ai-chat-panel.ai-chat-panel-maximized #ai-chat-maximize:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h10a2 2 0 0 1 2 2v10'/%3E%3Crect x='3' y='9' width='12' height='12' rx='1.5' ry='1.5'/%3E%3C/svg%3E");
}

/* Schließen-Button */
#ai-chat-close {
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px 10px 8px;
    border-radius: 6px;
    border: 1.5px solid #e2e8f0 !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ai-chat-close:hover {
    background: #f1f5f9;
    color: #475569;
}

@media (max-width: 767px) {
    #ai-chat-panel.ai-chat-panel-maximized {
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;
    }
}

/* ---------- Disabled-Zustand ---------- */
#ai-chat-send:disabled,
#ai-chat-new:disabled,
#ai-chat-delete:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

/* ---------- Markdown in Nachrichten ---------- */
.ai-chat-message-text { margin-bottom: 0; }
.ai-chat-message-text-spaced { margin-bottom: 10px; }

.ai-chat-message-markdown {
    white-space: normal;
    overflow-wrap: anywhere;
}

.ai-chat-message-markdown > :first-child { margin-top: 0; }
.ai-chat-message-markdown > :last-child { margin-bottom: 0; }

.ai-chat-message-markdown p,
.ai-chat-message-markdown ul,
.ai-chat-message-markdown ol,
.ai-chat-message-markdown pre,
.ai-chat-message-markdown blockquote {
    margin: 0 0 10px;
}

.ai-chat-message-markdown ul,
.ai-chat-message-markdown ol { padding-left: 20px; }

.ai-chat-message-markdown code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    font-family: 'Fira Code', Consolas, Monaco, monospace;
    font-size: 12px;
    color: var(--color-highlight);
}

.ai-chat-message-markdown pre {
    padding: 12px;
    border-radius: 8px;
    background: #f1f5f9;
    overflow: auto;
    border: 1px solid #e2e8f0;
}

.ai-chat-message-markdown pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

/* ---------- Bilder ---------- */
.ai-chat-image-list { display: grid; gap: 10px; }
.ai-chat-image-item { display: flex; flex-direction: column; gap: 6px; }
.ai-chat-image-link { display: block; }

.ai-chat-generated-image {
    display: block;
    max-width: min(100%, 380px);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.ai-chat-image-meta {
    font-size: 11px;
    color: #94a3b8;
    white-space: pre-wrap;
}
