/* Der KI-Helfer: Sprechblase unten rechts plus Panel.
   Eigene Datei statt Anhang an erp.css -- sie gilt fuer genau ein Bauteil und
   laedt nur, wo das Widget auch gerendert wird. */

.assistant-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    font-size: 0.9rem;
}

.assistant-toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #1f4e79;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.assistant-toggle:hover { background: #2a659b; }

.assistant-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Muss sein: `display: flex` oben ist eine Klassenregel und schlaegt die
   Grundregel des Browsers `[hidden] { display: none }`. Ohne diese Zeile
   bleibt das Panel dauerhaft offen -- weder der Schliessen-Knopf noch das
   `hidden` im Markup haetten eine Wirkung. */
.assistant-panel[hidden] { display: none; }

.assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #1f4e79;
    color: #fff;
}

.assistant-link {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.assistant-log {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f7f9fb;
}

.assistant-msg { margin-bottom: 0.6rem; display: flex; }
.assistant-msg-user { justify-content: flex-end; }

.assistant-msg-body {
    max-width: 85%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #fff;
    border: 1px solid #dde3e9;
}

.assistant-msg-user .assistant-msg-body {
    background: #1f4e79;
    border-color: #1f4e79;
    color: #fff;
}

.assistant-error {
    margin-top: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: #fdecea;
    color: #8b1a10;
    font-size: 0.85rem;
}

.assistant-rating { margin-top: 0.25rem; }
.assistant-rating button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0 0.15rem;
}

.assistant-suggestions { display: flex; flex-direction: column; gap: 0.35rem; }
.assistant-suggestions button {
    text-align: left;
    background: #fff;
    border: 1px solid #dde3e9;
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
}

.assistant-input {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem;
    border-top: 1px solid #e3e8ed;
}

.assistant-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font: inherit;
}

.assistant-foot {
    padding: 0.35rem 0.6rem 0.5rem;
    font-size: 0.75rem;
    color: #6b7780;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.assistant-credit { color: #8b959c; }

/* Vollbildseite */
.assistant-page-log { margin: 1rem 0; }
.assistant-page-log .assistant-msg-body { max-width: 60ch; }
.assistant-page-form textarea { width: 100%; max-width: 60ch; }
.assistant-page-actions { margin: 0.5rem 0 1rem; }

@media (max-width: 640px) {
    .assistant-widget { right: 0.75rem; bottom: 0.75rem; }
    .assistant-panel {
        position: fixed;
        inset: 0;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 0;
    }
}
