#sh-ai-chatbot-root {
    --sh-primary: #0f766e;
    --sh-primary-hover: #115e59;
    --sh-bg: #ffffff;
    --sh-surface: #f8fafc;
    --sh-border: #e2e8f0;
    --sh-text: #0f172a;
    --sh-muted: #64748b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

.sh-hidden {
    display: none !important;
}

/* Schwebender Launcher-Button */
.sh-chat-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--sh-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sh-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.28);
}

.sh-launcher-icon {
    font-size: 20px;
    line-height: 1;
}

/* Haupt-Chatfenster */
.sh-chat-panel {
    width: 410px;
    max-width: calc(100vw - 24px);
    height: 620px;
    max-height: calc(100vh - 40px);
    background: var(--sh-bg);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    border: 1px solid var(--sh-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sh-chat-header {
    background: var(--sh-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sh-header-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.sh-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.sh-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* prominenter Sprachmodus-Button */
.sh-voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.sh-voice-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.sh-voice-btn.sh-voice-active {
    background: #ef4444;
    border-color: #fecaca;
    animation: sh-pulse 1.6s infinite;
}

@keyframes sh-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sh-reset-btn,
.sh-close-btn {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 17px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sh-reset-btn:hover,
.sh-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sh-close-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Schnellauswahl-Chips */
.sh-quick-chips {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: var(--sh-surface);
    border-bottom: 1px solid var(--sh-border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.sh-chip {
    flex: 0 0 auto;
    background: #fff;
    color: var(--sh-text);
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
}

.sh-chip:hover {
    border-color: var(--sh-primary);
    background: #f0fdfa;
}

/* Nachrichten-Bereich */
.sh-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sh-msg {
    max-width: 86%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.48;
    word-wrap: break-word;
}

.sh-msg p {
    margin: 0 0 8px 0;
}

.sh-msg p:last-child {
    margin-bottom: 0;
}

.sh-msg-bot {
    align-self: flex-start;
    background: #ffffff;
    color: var(--sh-text);
    border: 1px solid var(--sh-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
}

.sh-msg-user {
    align-self: flex-end;
    background: var(--sh-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Strukturierte Pfandschein-Übersichtskarte im Chat */
.sh-pawn-card {
    margin-top: 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    color: #134e4a;
}

.sh-pawn-card-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: #0f766e;
}

.sh-pawn-card-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dashed rgba(15, 118, 110, 0.18);
}

.sh-pawn-card-row:last-child {
    border-bottom: none;
}

/* Action Buttons (Stripe & PDF Download) */
.sh-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 11px 14px;
    background: #4f46e5;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    box-sizing: border-box;
    text-align: center;
    transition: background 0.2s;
}

.sh-action-btn:hover {
    background: #4338ca;
}

.sh-pdf-btn {
    background: #15803d;
}

.sh-pdf-btn:hover {
    background: #166534;
}

/* Aktive Sprachmodus-Leiste */
.sh-live-voice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    color: #991b1b;
    font-size: 12px;
    font-weight: 500;
}

.sh-wave-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 16px;
}

.sh-wave-indicator span {
    width: 3px;
    height: 12px;
    background: #ef4444;
    border-radius: 2px;
    animation: sh-wave 1s infinite ease-in-out;
}

.sh-wave-indicator span:nth-child(2) { animation-delay: 0.15s; }
.sh-wave-indicator span:nth-child(3) { animation-delay: 0.3s; }
.sh-wave-indicator span:nth-child(4) { animation-delay: 0.45s; }

@keyframes sh-wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1.1); }
}

.sh-voice-stop-inline {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

/* Texteingabe unten */
.sh-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid var(--sh-border);
}

.sh-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}

.sh-chat-input:focus {
    border-color: var(--sh-primary);
}

.sh-send-btn {
    background: var(--sh-primary);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    body.sh-chat-open {
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    #sh-ai-chatbot-root {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: var(--sh-viewport-height, 100dvh);
        max-height: var(--sh-viewport-height, 100dvh);
        pointer-events: none;
        z-index: 999999;
    }

    #sh-ai-chatbot-root > * {
        pointer-events: auto;
    }

    .sh-chat-launcher {
        position: fixed;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: 16px;
    }

    .sh-chat-panel {
        position: fixed;
        top: var(--sh-viewport-top, 0px);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: var(--sh-viewport-height, 100dvh);
        max-height: var(--sh-viewport-height, 100dvh);
        border-radius: 0;
        border: none;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sh-chat-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        padding-left: calc(14px + env(safe-area-inset-left, 0px));
        padding-right: calc(14px + env(safe-area-inset-right, 0px));
        flex-shrink: 0;
    }

    .sh-quick-chips {
        flex-shrink: 0;
    }

    .sh-chat-messages {
        flex: 1 1 0%;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-left: calc(14px + env(safe-area-inset-left, 0px));
        padding-right: calc(14px + env(safe-area-inset-right, 0px));
    }

    .sh-chat-input-area {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding-left: calc(12px + env(safe-area-inset-left, 0px));
        padding-right: calc(12px + env(safe-area-inset-right, 0px));
        flex-shrink: 0;
    }

    .sh-chat-input {
        font-size: 16px; /* Verhindert unerwuenschtes automatisches iOS Safari Hineinzoomen */
    }
}


/* Sicherheits-Badge (z. B. Pfandschein verloren / Vollmacht) */
.sh-info-badge {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 7px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
}

/* Verlängerungs-Optionen im Pfand-Kärtchen */
.sh-ext-options-header {
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #0f766e;
}

.sh-ext-btn-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sh-ext-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    text-align: center;
}

.sh-ext-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.sh-ext-btn-rec {
    background: #0f766e;
}

.sh-ext-btn-rec:hover {
    background: #115e59;
}

/* Filial-Finder Karten */
.sh-branches-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.sh-branch-card {
    background: #ffffff;
    border: 1px solid var(--sh-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.sh-branch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    color: var(--sh-primary);
    font-size: 13.5px;
}

.sh-branch-bezirk {
    font-size: 11px;
    background: #e2e8f0;
    padding: 2px 7px;
    border-radius: 999px;
    color: #334155;
    font-weight: 600;
}

.sh-branch-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12.5px;
    color: var(--sh-text);
    border-bottom: 1px dashed rgba(226, 232, 240, 0.8);
}

.sh-branch-row:last-of-type {
    border-bottom: none;
}

.sh-branch-row a {
    color: var(--sh-primary);
    text-decoration: none;
    font-weight: 600;
}

.sh-branch-actions {
    margin-top: 8px;
}

.sh-maps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    background: #f1f5f9;
    color: #0f172a !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.sh-maps-btn:hover {
    background: #e2e8f0;
}

.sh-stripe-btn {
    background: #635bff !important;
    box-shadow: 0 4px 14px rgba(99, 91, 255, 0.35);
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
}
.sh-stripe-btn:hover {
    background: #4e44e9 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 91, 255, 0.45);
}
