#lb-support-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#lb-support-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #1e5128;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#lb-support-toggle:hover {
    background: #4e9f3d;
}

#lb-support-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: min(520px, calc(100vh - 100px));
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    flex-direction: column;
}

#lb-support-panel.open {
    display: flex;
    flex-direction: column;
}

#lb-support-panel.open.lb-chat-mode {
    height: min(480px, calc(100vh - 100px));
    min-height: 320px;
}

#lb-support-panel.open > #lb-support-body {
    flex: 1 1 auto;
    min-height: 0;
}

#lb-support-panel header {
    flex: 0 0 auto;
    background: #1e5128;
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#lb-support-panel header button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

#lb-support-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#lb-support-body.lb-chat-mode {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#lb-support-body label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 4px;
    color: #333;
}

#lb-support-body input,
#lb-support-body select,
#lb-support-body textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

#lb-support-body textarea {
    min-height: 80px;
    resize: vertical;
}

.lb-support-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #1e5128;
    background: #fff;
    color: #1e5128;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.lb-support-btn.primary {
    background: #1e5128;
    color: #fff;
    text-align: center;
}

.lb-support-btn:hover {
    background: #f0f7f2;
}

.lb-support-btn.primary:hover {
    background: #4e9f3d;
    border-color: #4e9f3d;
}

.lb-support-hint {
    font-size: 12px;
    color: #666;
    margin-top: 12px;
    line-height: 1.5;
}

.lb-support-msg {
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.lb-support-msg.success {
    background: #e8f5e9;
    color: #1e5128;
}

.lb-support-msg.error {
    background: #ffebee;
    color: #b71c1c;
}

.lb-support-ticket-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lb-support-ticket-list li {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

.lb-support-ticket-list a {
    color: #1e5128;
    text-decoration: none;
    font-weight: 600;
}

.lb-support-back {
    background: none;
    border: none;
    color: #1e5128;
    cursor: pointer;
    padding: 0;
    margin-bottom: 10px;
    font-size: 13px;
}

.lb-chat-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.lb-chat-top {
    flex: 0 0 auto;
    padding: 10px 14px 0;
}

#lb-chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px 14px;
    background: #f5f7f5;
}

.lb-chat-footer {
    flex: 0 0 auto;
    padding: 12px 14px 14px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    position: relative;
    z-index: 2;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.lb-chat-bubble {
    max-width: 88%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.lb-chat-bubble.customer {
    background: #fff;
    border: 1px solid #ddd;
    margin-right: auto;
}

.lb-chat-bubble.admin {
    background: #1e5128;
    color: #fff;
    margin-left: auto;
}

.lb-chat-bubble.system {
    background: #fff8e6;
    font-size: 12px;
    text-align: center;
    max-width: 100%;
    color: #666;
}

.lb-chat-bubble.admin .lb-chat-meta {
    color: rgba(255, 255, 255, 0.85);
}

.lb-chat-meta {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.lb-chat-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.lb-chat-footer textarea,
.lb-chat-compose-row textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    min-height: 48px;
    max-height: 96px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    background: #fff;
    color: #222;
    box-sizing: border-box;
}

.lb-chat-footer textarea:focus,
.lb-chat-compose-row textarea:focus {
    outline: none;
    border-color: #1e5128;
    box-shadow: 0 0 0 2px rgba(30, 81, 40, 0.15);
}

.lb-chat-send-btn {
    flex-shrink: 0;
    width: auto !important;
    min-width: 72px;
    margin-top: 0 !important;
    padding: 10px 16px !important;
    text-align: center !important;
}

.lb-chat-end-btn {
    width: 100%;
    margin-top: 8px !important;
    font-size: 13px !important;
    padding: 8px 12px !important;
    text-align: center !important;
    color: #666 !important;
    border-color: #ddd !important;
}

.lb-chat-status {
    font-size: 12px;
    color: #4e9f3d;
    margin-bottom: 8px;
}

.lb-chat-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4e9f3d;
    border-radius: 50%;
    margin-right: 6px;
    animation: lb-chat-pulse 1.5s ease-in-out infinite;
}

@keyframes lb-chat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@media (max-width: 480px) {
    #lb-support-root {
        bottom: 12px;
        right: 12px;
    }
    #lb-support-panel {
        width: calc(100vw - 24px);
    }
}
