#law4usChatbotRoot {
    --law4us-header-color: #0f2f4e;
    --law4us-primary-color: #0f2f4e;
    --law4us-scale: 1;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

#law4usChatbotRoot[data-position="bottom_left"] {
    right: auto;
    left: 24px;
}

.law4us-chatbot-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 50px;
    background: var(--law4us-primary-color);
    color: #fff;
    padding: 14px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 16px;
    transform: scale(var(--law4us-scale, 1));
    transform-origin: bottom right;
    transition: transform 0.15s ease;
}

#law4usChatbotRoot[data-position="bottom_left"] .law4us-chatbot-toggle {
    transform-origin: bottom left;
}

.law4us-chatbot-toggle:hover {
    transform: scale(var(--law4us-scale, 1)) translateY(-2px);
}

.law4us-chatbot-toggle-label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.law4us-chatbot-panel {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: calc(390px * var(--law4us-scale, 1));
    max-width: calc(100vw - 32px);
    height: calc(560px * var(--law4us-scale, 1));
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    flex-direction: column;
    z-index: 99999;
}

#law4usChatbotRoot[data-position="bottom_left"] .law4us-chatbot-panel {
    right: auto;
    left: 24px;
}

#law4usChatbotRoot.open .law4us-chatbot-panel {
    display: flex;
}

.law4us-chatbot-header {
    background: var(--law4us-header-color);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.law4us-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.law4us-chatbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.law4us-chatbot-title {
    font-weight: 700;
    font-size: 14px;
}

.law4us-chatbot-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.law4us-chatbot-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}

.law4us-chatbot-header-actions button {
    background: transparent;
    border: none;
    color: #fff;
    opacity: 0.85;
    font-size: 14px;
    padding: 6px;
    cursor: pointer;
}

.law4us-chatbot-header-actions button:hover {
    opacity: 1;
}

.law4us-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.law4us-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-line;
}

/* Let the text shrink inside the flex user bubble so long unbroken
   words wrap instead of overflowing past the edge. */
.law4us-msg > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.law4us-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.law4us-msg-user {
    align-self: flex-end;
    background: var(--law4us-primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.law4us-msg-edit {
    flex-shrink: 0;
    border: none;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.law4us-msg-edit:hover {
    background: rgba(255, 255, 255, 0.4);
}

.law4us-chatbot-typing {
    padding: 6px 16px;
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: #f5f7fa;
}

.law4us-chatbot-typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
    animation: law4usTypingBlink 1.2s infinite ease-in-out;
}

.law4us-chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.law4us-chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes law4usTypingBlink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

.law4us-chatbot-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 12px 14px;
    flex-shrink: 0;
    background: #fff;
    max-height: 45vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.law4us-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.law4us-chip {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.law4us-chip:hover {
    border-color: var(--law4us-primary-color);
    color: var(--law4us-primary-color);
}

.law4us-chip.selected {
    background: var(--law4us-primary-color);
    border-color: var(--law4us-primary-color);
    color: #fff;
}

.law4us-searchable-select {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.law4us-searchable-select-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    font-size: 13.5px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
}

.law4us-searchable-select-input:focus {
    border-bottom-color: var(--law4us-primary-color);
}

.law4us-searchable-select-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.law4us-searchable-select-item {
    text-align: left;
    background: #fff;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    padding: 9px 12px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
}

.law4us-searchable-select-item:last-child {
    border-bottom: none;
}

.law4us-searchable-select-item:hover {
    background: #f5f7fa;
    color: var(--law4us-primary-color);
}

.law4us-searchable-select-empty {
    padding: 12px;
    font-size: 12.5px;
    color: #9ca3af;
    text-align: center;
}

.law4us-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.law4us-input-row input[type="text"],
.law4us-input-row input[type="email"],
.law4us-input-row input[type="tel"],
.law4us-input-row textarea,
.law4us-input-row select.law4us-select {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13.5px;
    resize: none;
    font-family: inherit;
    background: #fff;
    color: #111827;
}

.law4us-input-row textarea {
    min-height: 64px;
}

.law4us-send-btn,
.law4us-continue-btn {
    background: var(--law4us-primary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.law4us-send-btn:disabled,
.law4us-continue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.law4us-char-counter {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
    margin-top: 4px;
}

.law4us-error-text {
    color: #dc2626;
    font-size: 12px;
    margin-top: 6px;
}

.law4us-summary-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    font-size: 12.5px;
    max-width: 100%;
    box-sizing: border-box;
}

.law4us-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    min-width: 0;
}

.law4us-summary-row:last-child {
    border-bottom: none;
}

.law4us-summary-label {
    color: #6b7280;
    font-weight: 600;
    flex-shrink: 0;
}

.law4us-summary-value {
    text-align: right;
    color: #111827;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Long values (e.g. the issue description) wrap onto their own line below
   the label instead of forcing a horizontal scrollbar on the summary card. */
.law4us-summary-row.law4us-summary-row--stack {
    flex-direction: column;
    align-items: flex-start;
}

.law4us-summary-row--stack .law4us-summary-value {
    text-align: left;
}

.law4us-summary-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.law4us-summary-actions button {
    flex: 1;
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.law4us-summary-actions .law4us-submit-btn {
    background: var(--law4us-primary-color);
    color: #fff;
    border-color: var(--law4us-primary-color);
}

/* Mobile responsive */
@media (max-width: 576px) {
    .law4us-chatbot-panel {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
    }

    #law4usChatbotRoot[data-position="bottom_left"] .law4us-chatbot-panel {
        left: 0;
    }

    .law4us-chatbot-toggle-label {
        display: none;
    }

    .law4us-chatbot-toggle {
        padding: 14px;
    }
}
