.portal-chatbot {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1080;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.portal-chat-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0d9488, #0891b2);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.45);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

.portal-chat-toggle:hover { transform: scale(1.05); }

.portal-chat-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    background: #f97316;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.portal-chat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: min(360px, calc(100vw - 2rem));
    height: 480px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.portal-chat-header {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #fff;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.portal-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f8fafc;
}

.portal-msg {
    max-width: 88%;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.portal-msg.user {
    margin-left: auto;
    background: #0d9488;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.portal-msg.assistant, .portal-msg.system {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.portal-chat-form.d-none { display: none !important; }
.portal-chat-actions.d-none { display: none !important; }

.portal-escalate-form {
    padding: 0.75rem;
    background: #f0fdfa;
    border-top: 1px solid #99f6e4;
}
.portal-escalate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #0f766e;
    font-size: 0.9rem;
}
.portal-escalate-form textarea {
    resize: vertical;
    min-height: 72px;
}

.portal-chat-form {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.portal-chat-actions .btn-outline-light {
    color: #0f766e;
    border-color: #99f6e4;
    background: #f0fdfa;
    font-size: 0.72rem;
}

@media (max-width: 480px) {
    .portal-chat-panel { height: 70vh; bottom: 64px; right: -0.5rem; }
}
