/* Schwebendes Chat-Widget - einbaubar in jede Website */

#lkchat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    color: #263238;
}

/* Floating Action Button (FAB) */
.lkw-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(46,125,50,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s, box-shadow .18s;
    position: relative;
    padding: 0;
}
.lkw-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 8px 24px rgba(46,125,50,.55); }
.lkw-fab:active { transform: scale(.96); }
.lkw-fab svg { width: 28px; height: 28px; }
.lkw-fab .lkw-fab-close { display: none; }
.lkw-fab.open .lkw-fab-open { display: none; }
.lkw-fab.open .lkw-fab-close { display: block; }
.lkw-fab.open { background: #455a64; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

/* Begrüßungs-Popover bevor Chat geöffnet wird */
.lkw-hint {
    position: absolute;
    right: 72px;
    bottom: 8px;
    background: white;
    padding: 9px 14px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    font-size: 13px;
    white-space: nowrap;
    color: #263238;
    animation: lkw-pop 4s ease-out 1s both;
    pointer-events: none;
}
.lkw-hint::after {
    content: '';
    position: absolute;
    right: -5px;
    bottom: 14px;
    border: 5px solid transparent;
    border-left-color: white;
    border-bottom: 0;
}
@keyframes lkw-pop {
    0%   { opacity: 0; transform: translateY(8px); }
    8%   { opacity: 1; transform: translateY(0); }
    90%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(0); }
}
#lkchat-widget.open .lkw-hint,
#lkchat-widget.user-engaged .lkw-hint { display: none; }

/* Chat-Panel */
.lkw-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: min(600px, calc(100vh - 110px));
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: lkw-open .22s cubic-bezier(.2, .7, .3, 1.2);
}
#lkchat-widget.open .lkw-panel { display: flex; }
@keyframes lkw-open {
    from { transform: scale(.85) translateY(8px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* Panel-Header */
.lkw-head {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.lkw-head-logo {
    width: 38px;
    height: 38px;
    background: white;
    color: #2e7d32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .02em;
}
.lkw-head-text { flex: 1; min-width: 0; line-height: 1.25; }
.lkw-head-title { font-weight: 600; font-size: 15px; }
.lkw-head-sub { font-size: 11.5px; opacity: .85; display: flex; align-items: center; gap: 4px; }
.lkw-head-sub::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #81c784;
    border-radius: 50%;
    box-shadow: 0 0 6px #81c784;
}
.lkw-head-close,
.lkw-head-reset {
    background: rgba(255,255,255,.15);
    color: white;
    border: 0;
    /* Visuell 32, Hit-Area 44 - erfüllt WCAG 2.5.5 ohne den Header optisch
       aufzublasen. */
    width: 32px;
    height: 32px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}
.lkw-head-close:hover,
.lkw-head-reset:hover { background: rgba(255,255,255,.25); }
.lkw-head-reset { font-size: 14px; }

/* Resize-Grip oben links - nur Desktop. Streifen-Muster um 180° gedreht,
   damit der "Anfasser" optisch zum Eck oben-links zeigt statt von ihm weg. */
.lkw-resize-grip {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 45%, rgba(255,255,255,.7) 45%, rgba(255,255,255,.7) 55%, transparent 55%),
        linear-gradient(135deg, transparent 65%, rgba(255,255,255,.5) 65%, rgba(255,255,255,.5) 75%, transparent 75%);
    transform: rotate(180deg);
}
.lkw-resize-grip:hover {
    background:
        linear-gradient(135deg, transparent 45%, white 45%, white 55%, transparent 55%),
        linear-gradient(135deg, transparent 65%, white 65%, white 75%, transparent 75%);
}
.lkw-head { position: relative; }

/* Nachrichten-Bereich */
.lkw-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background:
        radial-gradient(rgba(46,125,50,.04) 1px, transparent 1px) 0 0 / 24px 24px,
        #f7f3ec;
}

.lkw-msg { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; animation: lkw-msg-in .2s ease-out; }
.lkw-msg.user { justify-content: flex-end; }
@keyframes lkw-msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.lkw-avatar {
    width: 28px; height: 28px;
    background: #2e7d32;
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: .02em;
}
.lkw-msg.user .lkw-avatar { display: none; }
.lkw-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    line-height: 1.42;
    font-size: 13.5px;
    box-shadow: 0 1px 1.5px rgba(0,0,0,.07);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.lkw-msg.bot .lkw-bubble { background: white; border-top-left-radius: 4px; }
.lkw-msg.user .lkw-bubble { background: #d9f5d4; border-top-right-radius: 4px; color: #1b4d20; }
.lkw-bubble p { margin: 0 0 5px; }
.lkw-bubble p:last-child { margin-bottom: 0; }
.lkw-bubble strong { color: #2e7d32; }
.lkw-bubble a { color: #2e7d32; }
/* U14: WCAG-AA-Kontrast (>=4.5:1 für kleinen Text). #607d8b mit opacity .7
   ergab nur ~2.8:1 auf weiß. #455a64 ohne opacity erreicht ~5.7:1. */
.lkw-bubble .time { display: block; text-align: right; font-size: .62rem; color: #455a64; margin-top: 3px; }
.lkw-bubble ul { margin: 6px 0; padding: 0; list-style: none; }
.lkw-bubble li {
    margin: 5px 0;
    padding: 7px 10px;
    background: rgba(46,125,50,.06);
    border-left: 3px solid rgba(46,125,50,.4);
    border-radius: 4px;
    font-size: .87rem;
    line-height: 1.4;
}
.lkw-bubble li a { color: #2e7d32; }
.lkw-bubble li strong { font-weight: 600; }

.lkw-mit-cards {
    margin-top: 7px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lkw-mit-cards .lkw-mit-card { margin-top: 0; }
.lkw-mit-card {
    margin-top: 7px;
    padding: 8px;
    background: rgba(46,125,50,.06);
    border: 1px solid rgba(46,125,50,.18);
    border-radius: 9px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.lkw-mit-card img,
.lkw-mit-card .lkw-mit-noimg {
    width: 56px; height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.lkw-mit-card .lkw-mit-noimg {
    background: #2e7d32;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.02em;
}
.lkw-mit-text { flex: 1; min-width: 0; font-size: 12px; }
.lkw-mit-name { font-weight: 600; color: #2e7d32; font-size: 13.5px; }
.lkw-mit-fkt { color: #263238; font-size: 11.5px; margin: 1px 0; line-height: 1.3; }
.lkw-mit-abt { color: #607d8b; font-size: 10.5px; margin: 0 0 4px; font-style: italic; }
.lkw-mit-actions { display: flex; flex-direction: column; gap: 1px; }
.lkw-mit-actions a { color: #2e7d32; text-decoration: none; font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
/* SVG-Icon vor dem Link-Text. Größe folgt der Schriftgröße. */
.lkw-icon { width: 13px; height: 13px; flex: 0 0 13px; }

.lkw-sources {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed rgba(46,125,50,.25);
    font-size: 11.5px;
}
.lkw-sources-t { color: #455a64; font-weight: 600; margin-bottom: 2px; }
.lkw-sources ul { margin: 0; padding-left: 4px; list-style: none; }
.lkw-sources li { margin: 1px 0; }
.lkw-sources a { color: #2e7d32; }
.lkw-sources-idx { color: #888; font-weight: 600; margin-right: 3px; }
.lkw-bubble sup .lkw-footnote-link {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
    padding: 0 1px;
}
.lkw-bubble sup .lkw-footnote-link:hover { text-decoration: underline; }

/* C3: Daumen-hoch/runter Feedback. Dezent unter der Antwort,
   genauso wie die Quellen-Box (gleiche dezente Trennlinie). */
.lkw-feedback {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed rgba(46,125,50,.25);
    font-size: 11.5px;
    color: #455a64;
}
.lkw-fb-label { margin-right: 2px; }
.lkw-fb-btn {
    background: none;
    border: 1px solid transparent;
    color: #607d8b;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}
.lkw-fb-btn:hover { border-color: #cfd8dc; color: #2e7d32; }
.lkw-fb-btn.lkw-fb-active { color: #2e7d32; }
.lkw-feedback.lkw-fb-done .lkw-fb-btn { pointer-events: none; opacity: 0.55; }
.lkw-feedback.lkw-fb-done .lkw-fb-btn.lkw-fb-active { opacity: 1; }

/* Streaming-Bubble: Antwort-Text wird inkrementell befüllt während das
   Backend rendert. Der blinkende Cursor signalisiert dass mehr Text kommt. */
.lkw-msg-streaming .lkw-bubble { position: relative; }
.lkw-stream-body { display: inline; }
.lkw-stream-cursor {
    display: inline-block;
    width: 7px; height: 1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: #2e7d32;
    border-radius: 1px;
    animation: lkw-cursor-blink 0.9s steps(2, start) infinite;
}
@keyframes lkw-cursor-blink { to { visibility: hidden; } }

.lkw-typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.lkw-typing-dots span {
    width: 6px; height: 6px;
    background: #90a4ae;
    border-radius: 50%;
    animation: lkw-blink 1.2s infinite;
}
.lkw-typing-dots span:nth-child(2) { animation-delay: .2s; }
.lkw-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes lkw-blink {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

/* Schnellantworten */
.lkw-quick {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 0 12px 10px;
    background: #f7f3ec;
    border-top: 1px solid rgba(0,0,0,.04);
}
.lkw-quick button {
    background: white;
    border: 1px solid rgba(46,125,50,.3);
    color: #2e7d32;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.lkw-quick button:hover { background: rgba(46,125,50,.08); }

/* Input-Bereich */
.lkw-input {
    display: flex; align-items: flex-end; gap: 6px;
    padding: 9px 10px;
    background: white;
    border-top: 1px solid rgba(0,0,0,.08);
}
.lkw-input textarea {
    flex: 1;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 18px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
    resize: none;
    max-height: 100px;
    min-height: 36px;
}
.lkw-input textarea:focus { outline: none; border-color: #2e7d32; }
.lkw-input button {
    background: #2e7d32;
    color: white; border: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
}
.lkw-input button:hover { background: #1b5e20; }
.lkw-input button:disabled { opacity: .55; cursor: not-allowed; }
.lkw-input button svg { width: 18px; height: 18px; }

/* Mikrofon-Button: dezenter als der grüne Senden-Button, klar als
   Sekundär-Aktion erkennbar. Während der Aufnahme rot pulsierend. */
.lkw-input button#lkw-mic {
    background: #eceff1;
    color: #455a64;
}
.lkw-input button#lkw-mic:hover { background: #cfd8dc; color: #263238; }
.lkw-input button#lkw-mic.lkw-mic-recording {
    background: #c62828;
    color: #ffffff;
    animation: lkw-mic-pulse 1.1s ease-in-out infinite;
}
.lkw-input button#lkw-mic.lkw-mic-uploading {
    background: #eceff1;
    color: #455a64;
    animation: lkw-mic-spin 1s linear infinite;
}
@keyframes lkw-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,.55); }
    50%      { box-shadow: 0 0 0 7px rgba(198,40,40,0); }
}
@keyframes lkw-mic-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Negativ-Feedback Kommentarfeld - erscheint NACH dem Daumen-runter.
   Die Bewertung selbst ist da bereits gespeichert; dieses Feld reicht
   nur einen optionalen Kommentar nach. */
.lkw-fb-comment {
    flex-basis: 100%;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.lkw-fb-comment-text {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 8px;
    padding: 6px 9px;
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.35;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    background: #fff;
}
.lkw-fb-comment-text:focus { outline: none; border-color: #2e7d32; }
.lkw-fb-comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}
.lkw-fb-comment-actions button {
    border: 1px solid rgba(0,0,0,.15);
    background: #fff;
    color: #455a64;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
}
.lkw-fb-comment-actions .lkw-fb-comment-send {
    background: #2e7d32;
    color: #fff;
    border-color: #2e7d32;
}
.lkw-fb-comment-actions .lkw-fb-comment-send:hover { background: #1b5e20; }
.lkw-fb-comment-actions .lkw-fb-comment-skip:hover { background: #eceff1; }
.lkw-fb-comment-actions button:disabled { opacity: .55; cursor: not-allowed; }
.lkw-fb-comment-thanks {
    color: #2e7d32;
    font-size: 12px;
    padding: 4px 0;
}

.lkw-foot {
    padding: 5px 10px 7px;
    font-size: 10.5px;
    color: #78909c;
    text-align: center;
    background: white;
}

/* Mobile: Vollbild */
/* Mobile-Vollbild: greift auf allen Touch-Geräten bis 900px Breite. Der
   alte Breakpoint (520px) hat moderne Phones mit ~412-440 dpx zwar getroffen,
   aber faltbare Phones (Z Fold ~717dpx) und Tablets im Portrait fielen
   raus und bekamen das schwebende Desktop-Panel statt Vollbild.
   `pointer: coarse` ist die zuverlässigste Touch-Detection. */
@media (max-width: 900px) and (pointer: coarse), (max-width: 520px) {
    #lkchat-widget { right: 12px; bottom: 12px; }
    .lkw-fab { width: 54px; height: 54px; }
    .lkw-panel {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        /* bottom MUSS weg: zusammen mit top: 0 + height entstünde ein
           Konflikt der `height` ignoriert. Wir verankern oben und lassen
           das Panel über --lkw-vh in die richtige Höhe wachsen. */
        width: 100%;
        max-width: 100%;
        /* --lkw-vh wird vom JS aus window.visualViewport.height gespeist und
           folgt der Tastatur zuverlässig (Android-Chrome ignoriert 100dvh in
           manchen Versionen). Fallback auf 100dvh, dann auf 100vh. */
        height: var(--lkw-vh, 100dvh);
        max-height: var(--lkw-vh, 100dvh);
        border-radius: 0;
    }
    /* Safe-Area-Padding für iPhone Notch (Header) und Home-Indicator (Input).
       Greift nur wenn viewport-fit=cover gesetzt ist (siehe demo.html-Meta). */
    .lkw-head { padding-top: calc(14px + env(safe-area-inset-top)); }
    .lkw-input { padding-bottom: calc(9px + env(safe-area-inset-bottom)); }
    .lkw-hint { display: none; }
    /* FAB hat im Mobile-Vollbild keinen Platz - das X im Header reicht.
       Sonst ueberlappt der FAB den Senden-Button. */
    #lkchat-widget.open .lkw-fab { display: none; }
    /* Resize-Grip ist im Mobile-Vollbild sinnlos */
    .lkw-resize-grip { display: none; }

    /* Artikel-Reader: ganzseitig statt zentriert mit Padding-Rahmen. Der
       dunkle Overlay-Rand ist auf Mobile nur störend und schluckt vertikalen
       Platz, den der Reader-Inhalt braucht.
       Der kleine Auswahl-Dialog (.lkw-art-choose) bleibt klein und zentriert -
       er enthält nur Titel + 2 Buttons und soll nicht den ganzen Screen füllen. */
    .lkw-art-overlay:has(.lkw-art-reader) { padding: 0; align-items: stretch; }
    .lkw-art-reader {
        width: 100%;
        max-width: 100%;
        height: var(--lkw-vh, 100dvh);
        max-height: var(--lkw-vh, 100dvh);
        border-radius: 0;
        box-shadow: none;
    }
    /* Safe-Area-Insets analog zum Chat-Panel - Header für Notch, Foot/Body
       fürs Home-Indicator. */
    .lkw-art-reader-head { padding-top: calc(16px + env(safe-area-inset-top)); }
    .lkw-art-reader-body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

/* ===== Artikel-Reader (Quellen-Modal im Demo-Widget) ===== */
/* z-index MUSS höher als das Widget-Root (999999) sein, sonst landet das
   Overlay hinter dem schwebenden Chat-Fenster. */
.lkw-art-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 40, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000000;
    padding: 16px;
}
.lkw-art-choose {
    position: relative;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
    padding: 22px 26px 18px;
    max-width: 460px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.lkw-art-choose-title {
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
    padding-right: 24px;
}
.lkw-art-choose-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.lkw-art-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #607d8b;
    padding: 2px 6px;
}
.lkw-art-close:hover { color: #2c3e50; }

.lkw-art-reader {
    position: relative;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
    width: 720px;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.lkw-art-reader-head {
    padding: 16px 22px 12px;
    border-bottom: 1px solid #e6eaee;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    position: relative;
}
.lkw-art-reader-head .lkw-art-close { color: rgba(255,255,255,.85); top: 10px; right: 12px; }
.lkw-art-reader-head .lkw-art-close:hover { color: white; }
.lkw-art-reader-titel {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    /* Platz für Summary-Button (~130px) + Close-Button (~32px) im Header. */
    padding-right: 160px;
    color: white;
}
.lkw-art-reader-body {
    padding: 20px 26px 22px;
    overflow-y: auto;
    flex: 1 1 auto;
    line-height: 1.65;
    color: #2c3e50;
    font-size: .95rem;
}
.lkw-art-meta { font-size: .8rem; color: #78909c; margin-bottom: 6px; letter-spacing: .02em; }
.lkw-art-titel { margin: 0 0 8px; color: #2e7d32; font-size: 1.35rem; line-height: 1.3; }
.lkw-art-lead { font-size: 1.02rem; color: #37474f; font-style: italic; margin: 0 0 14px; }
.lkw-art-text p { margin: 0 0 10px; }
.lkw-art-text h1, .lkw-art-text h2, .lkw-art-text h3 { color: #2e7d32; margin: 18px 0 6px; line-height: 1.3; }
.lkw-art-text h2 { font-size: 1.1rem; }
.lkw-art-text h3 { font-size: 1rem; }
.lkw-art-text a { color: #2e7d32; }
.lkw-art-text ul, .lkw-art-text ol { padding-left: 22px; margin: 0 0 12px; }
.lkw-art-text li { margin: 3px 0; }
.lkw-art-loading, .lkw-art-empty { color: #78909c; font-style: italic; padding: 12px 0; }

/* "Zusammenfassen"-Button im Reader-Header (links neben dem ×). */
.lkw-art-summary-btn {
    position: absolute;
    top: 10px;
    right: 46px;
    background: rgba(255,255,255,.15);
    color: rgba(255,255,255,.95);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 999px;
    padding: 4px 11px 4px 8px;
    font: inherit;
    font-size: .82rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.lkw-art-summary-btn:hover { background: rgba(255,255,255,.28); }
.lkw-art-summary-btn:disabled { opacity: .55; cursor: progress; }
.lkw-art-summary-btn svg { display: block; }
.lkw-art-summary-btn-label { white-space: nowrap; }
/* Auf Touch-Geräten bis 900px (moderne Phones, faltbare, kleine Tablets):
   Button auf reines Icon reduzieren und Titel-Padding entsprechend kürzen. */
@media (max-width: 900px) and (pointer: coarse), (max-width: 520px) {
    .lkw-art-summary-btn-label { display: none; }
    .lkw-art-summary-btn { padding: 6px 8px; }
    .lkw-art-reader-titel { padding-right: 84px; }
}

/* Slot direkt unter dem Header für die KI-Zusammenfassung. */
.lkw-art-summary-slot { padding: 0 26px; background: white; }
.lkw-art-summary {
    margin: 14px 0 0;
    border: 1px solid #c5e1c8;
    border-left: 3px solid #2e7d32;
    border-radius: 6px;
    background: #f3faf4;
    padding: 10px 13px 11px;
}
.lkw-art-summary-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: #2e7d32;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.lkw-art-summary-truncated, .lkw-art-summary-cache {
    font-size: .68rem;
    background: #e0efe1;
    color: #1b5e20;
    padding: 1px 7px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
.lkw-art-summary-cache { background: #eceff1; color: #455a64; }
.lkw-art-summary-body {
    color: #2c3e50;
    font-size: .92rem;
    line-height: 1.55;
}
.lkw-art-summary-body ul {
    margin: 4px 0;
    padding-left: 20px;
}
.lkw-art-summary-body li { margin: 2px 0; }
.lkw-art-summary-body p { margin: 4px 0; }
.lkw-art-summary-body a { color: #2e7d32; }
.lkw-art-summary-progress { color: #607d8b; font-size: .85rem; margin-left: 6px; }
.lkw-art-summary-foot {
    margin-top: 6px;
    color: #78909c;
    font-size: .72rem;
    font-style: italic;
}
.lkw-art-summary-error {
    background: #fff4f4;
    border-left-color: #c62828;
    border-color: #f1c1c1;
    color: #842029;
}
.lkw-art-reader-foot {
    padding: 10px 22px;
    border-top: 1px solid #e6eaee;
    background: #fafbfc;
    display: flex;
    justify-content: flex-end;
}
.lkw-btn {
    background: white;
    border: 1px solid #e6eaee;
    border-radius: 5px;
    padding: 7px 14px;
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
    color: #455a64;
    text-decoration: none;
    display: inline-block;
}
.lkw-btn:hover { background: #f2f7f3; border-color: #b7d3b8; }
.lkw-btn-primary {
    background: #2e7d32;
    color: white;
    border-color: #2e7d32;
}
.lkw-btn-primary:hover { background: #256528; border-color: #256528; color: white; }

/* Live-Daten-Badge in Quellen-Liste (Marktdaten/Wetter) */
.lkw-src-live {
    display: inline-block;
    background: #d32f2f;
    color: #fff;
    font-size: .68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-right: 4px;
    vertical-align: middle;
}
.lkw-src-stand {
    color: #555;
    font-size: .82rem;
    font-style: italic;
    margin-left: 4px;
}
/* Präfix-Tag für KB-Quellen: "Bauer vom 12.05.2025:" oder "LK Online:" */
.lkw-src-tag {
    color: #2e7d32;
    font-weight: 600;
    margin-right: 2px;
}

/* ============================================================
   Live-Widgets (Wetter + Marktdaten).
   Container-Queries statt Viewport-Media-Queries weil das Chat-
   Widget einen 380px-Container hat, der Viewport aber breiter ist.
   ============================================================ */
.lkw-widget {
    container-type: inline-size;
    container-name: lkw-w;
    margin: 14px 0;
    border: 1px solid rgba(20, 40, 60, .08);
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f4f7fb 100%);
    padding: 14px 14px 12px;
    box-shadow:
        0 1px 2px rgba(20, 40, 60, .04),
        0 8px 24px -10px rgba(20, 40, 60, .12);
    font-size: .92rem;
    overflow: hidden;
}
.lkw-w-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    color: #1a2733;
}
.lkw-w-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.0rem;
    line-height: 1.2;
}
.lkw-w-title-icon {
    width: 22px; height: 22px;
    flex: 0 0 22px;
}
.lkw-w-live {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px -2px rgba(220, 38, 38, .5);
    position: relative;
}
.lkw-w-live::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    animation: lkw-live-pulse 1.6s infinite;
}
@keyframes lkw-live-pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: .4; transform: scale(.7); }
}
.lkw-w-quelle {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(20, 40, 60, .06);
    font-size: .78rem;
    color: #5a6878;
}
.lkw-w-quelle a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}
.lkw-w-quelle a:hover { text-decoration: underline; }

/* ====================== Wetter ====================== */
.lkw-wt-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    background: #eef2f6;
    border-radius: 12px;
    padding: 4px;
}
.lkw-wt-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: transparent;
    border: none;
    padding: 6px 4px;
    min-height: 58px;
    border-radius: 9px;
    cursor: pointer;
    color: #455a64;
    transition: background .18s ease, color .18s ease, transform .12s ease;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}
@container lkw-w (max-width: 360px) {
    .lkw-wt-tab-temp { display: none; }
    .lkw-wt-tab { min-height: 52px; }
}
.lkw-wt-tab:active { transform: scale(.97); }
.lkw-wt-tab:hover { background: rgba(20,40,60,.04); }
.lkw-wt-tab.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .5);
}
.lkw-wt-tab-icon {
    width: 24px; height: 24px;
    flex: 0 0 24px;
    color: inherit;
}
.lkw-wt-tab.active .lkw-wt-tab-icon { filter: brightness(1.2); }
.lkw-wt-tab-label {
    font-size: .78rem;
    text-transform: capitalize;
}
.lkw-wt-tab-temp {
    font-size: .9rem;
    font-weight: 700;
    margin-top: 2px;
}

.lkw-wt-panel { display: none; }
.lkw-wt-panel.active { display: block; animation: lkw-wt-fade .25s ease; }
@keyframes lkw-wt-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Mobile-first: 1 Spalte. Bei Container >= 420px 3 Spalten. */
.lkw-wt-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
@container lkw-w (min-width: 420px) {
    .lkw-wt-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.lkw-wt-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(20, 40, 60, .06);
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 60px;
}
.lkw-wt-cell-icon {
    width: 28px; height: 28px;
    flex: 0 0 28px;
    color: #1d4ed8;
}
.lkw-wt-cell-body { min-width: 0; }
.lkw-wt-label {
    font-size: .68rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 500;
}
.lkw-wt-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.lkw-wt-warn,
.lkw-wt-noWarn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 500;
}
.lkw-wt-warn {
    background: linear-gradient(135deg, #fff4e0, #ffe0b2);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, .25);
}
.lkw-wt-noWarn {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #1b5e20;
    border: 1px solid rgba(46, 125, 50, .2);
}
.lkw-wt-warn-icon { width: 20px; height: 20px; flex: 0 0 20px; }

/* ====================== Markt ====================== */
.lkw-mw-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
@container lkw-w (min-width: 480px) {
    .lkw-mw-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
.lkw-mw-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(20, 40, 60, .06);
    border-radius: 12px;
    padding: 10px 12px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.lkw-mw-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -8px rgba(20, 40, 60, .18);
}
.lkw-mw-icon-wrap {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lkw-mw-icon { width: 22px; height: 22px; }
.lkw-mw-body { flex: 1; min-width: 0; }
.lkw-mw-name {
    font-size: .82rem;
    color: #475569;
    line-height: 1.25;
    margin-bottom: 2px;
}
.lkw-mw-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 2px 0 4px;
}
.lkw-mw-wert {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}
.lkw-mw-einheit {
    font-size: .82rem;
    color: #64748b;
    font-weight: 500;
}
.lkw-mw-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: .74rem;
}
.lkw-mw-stand {
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 7px;
    border-radius: 4px;
}
.lkw-mw-q {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}
.lkw-mw-q:hover { text-decoration: underline; }

/* ============== Container-Query: kompakter Wetter-Container ============== */
@container lkw-w (max-width: 380px) {
    .lkw-w-title { font-size: .9rem; }
    .lkw-wt-val { font-size: 1.0rem; }
    .lkw-wt-cell-icon { width: 24px; height: 24px; }
    .lkw-mw-wert { font-size: 1.15rem; }
}
