.rb-chat {
    --p: #5856D6;
    --p2: #7B7AE0;
    --p-tint: #EEEEFE;
    --p-contrast: #ffffff;
    --p-soft-text: #5856D6;
    --bg: #F0F5F9;
    --surface: #ffffff;
    --surface2: #F7F8FC;
    --text: #111827;
    --text2: #6B7280;
    --text3: #9CA3AF;
    --line: #E5E7EB;
    --tag-bg: #F3F4F6;
    --tag-text: #374151;
    --status-ok: #16A34A;
    --status-warn: #B45309;
    --status-err: #DC2626;
    --radius: 16px;
    --set-help-size: 12px;
    --set-label-size: 14px;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

[data-theme="dark"] .rb-chat {
    --p: #8B88F0;
    --p2: #A8A6F5;
    --p-tint: rgba(139, 136, 240, .12);
    --p-contrast: #ffffff;
    --p-soft-text: #C9C7FF;
    --bg: #141416;
    --surface: #1C1C1F;
    --surface2: #232326;
    --text: #EBEBF0;
    --text2: #8E8E99;
    --text3: #5C5C66;
    --line: #2A2A2E;
    --tag-bg: #2A2A2E;
    --tag-text: #C4C4CC;
    --status-ok: #34C759;
    --status-warn: #FF9F0A;
    --status-err: #FF453A;
}

.rb-chat * {
    box-sizing: border-box;
}

.rb-chat #chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: var(--button-size, 60px);
    height: var(--button-size, 60px);
    background: var(--p);
    border-radius: 15px;
    display: var(--button-display-pc, flex);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform .16s, background .25s;
    box-shadow: -10px 0px 20px 2px rgba(0, 0, 0, .06);
    border: none;
    color: #fff;
}

.rb-chat #chat-fab:hover {
    transform: scale(1.07);
}

.rb-chat #chat-fab.hidden {
    display: none;
}

.rb-chat #chat-fab svg {
    max-width: 60px;
}

.rb-chat #fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: var(--status-err);
    border-radius: 12px;
    font-size: 12px;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
}

.rb-chat #chat-panel {
    position: fixed;
    bottom: 84px;
    right: 24px;
    width: var(--panel-width, 350px);
    height: var(--panel-height, 500px);
    background: var(--surface);
    border-radius: 18px;
    border: none;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .18), 0 8px 24px rgba(0, 0, 0, .10);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rb-chat #chat-panel.open {
    display: flex;
}

.rb-chat .chat-spinner {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
    pointer-events: none;
}

.rb-chat .chat-spinner.open {
    display: flex;
}

.rb-chat .chat-spinner-box {
    min-width: 132px;
    max-width: 220px;
    padding: 16px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .18), 0 6px 16px rgba(0, 0, 0, .08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.rb-chat .chat-spinner-ring {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(88, 86, 214, .18);
    border-top-color: var(--p);
    animation: rb-chat-spin .9s linear infinite;
}

.rb-chat .chat-spinner-text {
    font-size: 14px;
    color: var(--text);
    text-align: center;
    line-height: 1.4;
}

.rb-chat .cp-header {
    background: linear-gradient(135deg, var(--p), var(--p2));
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 13px;
    flex-shrink: 0;
}

.rb-chat .cp-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, .18);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rb-chat .cp-header-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.rb-chat .cp-header-info h3 {
    display: block;
    font-size: 16px;
    color: #fff;
    margin-top: 2px;
    margin-bottom: 3px;
    line-height: 100%;
}

.rb-chat .cp-header-info p {
    font-size: 12px;
    color: rgba(255, 255, 255, .68);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    margin-bottom: 0px;
}

.rb-chat .cp-header-info p::before {
    content: '';
    width: 5px;
    height: 5px;
    background: #4ADE80;
    border-radius: 50%;
    display: inline-block;
}

.rb-chat .cp-hbtns {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.rb-chat .cp-hbtn {
    height: 31px;
    padding: 0 13px;
    background: rgba(255, 255, 255, .12);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    font-size: 12px;
    color: rgba(255, 255, 255, .9);
}

.rb-chat #view-waiting {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
    align-items: center;
    padding: 24px;
    gap: 14px;
    background: var(--surface2);
}

.rb-chat #view-waiting p {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.7;
    text-align: center;
    white-space: pre-line;
}

.rb-chat .guest-lock-hero {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--p), var(--p2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 34px rgba(91, 78, 248, .22);
    margin-bottom: 2px;
}

.rb-chat .guest-lock-hero svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.rb-chat .guest-lock-title {
    font-size: 16px;
    color: var(--text);
    letter-spacing: -0.02em;
    text-align: center;
}

.rb-chat .guest-intro {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text2);
    text-align: center;
    white-space: pre-line;
}

.rb-chat .guest-fields {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rb-chat .guest-fields .set-input {
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.rb-chat .guest-waiting-note {
    display: none;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text2);
    text-align: center;
    white-space: pre-line;
    margin-top: 2px;
}

.rb-chat .guest-waiting-note.show {
    display: block;
}

.rb-chat #btn-request {
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: var(--p);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.rb-chat #btn-request:disabled {
    opacity: .55;
    cursor: default;
}

.rb-chat #admin-tabs-wrap,
.rb-chat #view-chat,
.rb-chat .admin-chat-wrap,
.rb-chat .admin-tab-content {
    flex: 1;
    min-height: 0;
}

.rb-chat #admin-tabs-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rb-chat .admin-tabs {
    display: flex;
    background: var(--surface2);
    flex-shrink: 0;
    height: 48px;
}

.rb-chat .admin-tab {
    flex: 1;
    padding: 0 8px;
    font-size: 13px;
    color: var(--text3);
    text-align: center;
    cursor: pointer;
    transition: all .14s;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.rb-chat .admin-tab.active {
    color: var(--p-soft-text);
    background: var(--surface);
    gap: 5px;
}

.rb-chat .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--status-err);
    color: #fff;
    font-size: 10px;
    border-radius: 20px;
    padding: 0 6px;
}

.rb-chat .tab-badge.hidden {
    display: none;
}

.rb-chat .admin-tab-content {
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rb-chat .admin-tab-content.active {
    display: flex;
}

.rb-chat .room-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 114, 128, .22) transparent;
}

.rb-chat .room-list::-webkit-scrollbar {
    width: 4px;
}

.rb-chat .room-list::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, .22);
    border-radius: 999px;
}

.rb-chat .room-list::-webkit-scrollbar-track {
    background: transparent;
}

.rb-chat .room-item {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background .14s;
    align-items: flex-start;
}

.rb-chat .room-item:hover {
    background: var(--surface2);
}

.rb-chat .room-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--p-tint);
    color: var(--p-soft-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    overflow: hidden;
}

.rb-chat .room-avatar.clickable,
.rb-chat .msg-avatar.clickable,
.rb-chat .room-name {
    cursor: pointer;
}

.rb-chat .room-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rb-chat .room-info {
    flex: 1;
    min-width: 0;
}

.rb-chat .room-name {
    font-size: 14px;
    color: var(--text);
}

.rb-chat .room-preview {
    font-size: 12px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.rb-chat .room-meta2 {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.rb-chat .room-time {
    font-size: 11px;
    color: var(--text3);
}

.rb-chat .room-unread {
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    background: var(--status-err);
    border-radius: 20px;
    color: #fff;
    font-size: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.rb-chat .room-del {
    width: 24px;
    height: 24px;
    background: var(--surface2);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    color: var(--text3);
}

.rb-chat .empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--text3);
    font-size: 13px;
}

.rb-chat #view-chat {
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
}

.rb-chat .admin-chat-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
}

.rb-chat .admin-chat-back {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.rb-chat .back-btn {
    min-width: 26px;
    height: 28px;
    background: var(--surface2);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    color: var(--text2);
    font-size: 11px;
    padding: 0 10px;
    white-space: nowrap;
}

.rb-chat .end-btn {
    margin-left: auto;
    height: 26px;
    padding: 0 10px;
    background: var(--p-tint);
    color: var(--p-soft-text);
    border: none;
    border-radius: 999px;
    font-size: 10px;
    cursor: pointer;
}

.rb-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface2);
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 114, 128, .22) transparent;
}

.rb-chat .chat-messages::-webkit-scrollbar {
    width: 4px;
}

.rb-chat .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, .22);
    border-radius: 999px;
}

.rb-chat .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.rb-chat .absence-banner {
    display: none;
    padding: 12px 14px;
    margin: 12px 16px;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-line;
    border: none;
}

.rb-chat .absence-banner.show {
    display: block;
}

.rb-chat .history-more-wrap {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: center;
    z-index: 3;
    padding: 2px 0 4px;
}

.rb-chat .history-more-btn {
    height: 28px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--text2);
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

[data-theme="dark"] .rb-chat .history-more-btn {
    background: rgba(35, 35, 38, .94);
    color: var(--text);
}

.rb-chat .msg-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.rb-chat .msg-row.me {
    flex-direction: row-reverse;
}

.rb-chat .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--p-tint);
    color: var(--p-soft-text);
    overflow: hidden;
}

.rb-chat .msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rb-chat .msg-body {
    max-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.rb-chat .msg-body {
    position: relative;
}

.rb-chat .msg-nick {
    font-size: 11px;
    color: var(--text3);
    margin-bottom: 3px;
}

.rb-chat .msg-row.me .msg-body {
    align-items: flex-end;
}

.rb-chat .msg-row.me .msg-nick {
    text-align: right;
}

.rb-chat .msg-bubble {
    max-width: 260px;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.6;
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rb-chat .msg-bubble .msg-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    vertical-align: baseline;
    word-break: break-all;
}

.rb-chat .msg-bubble .msg-inline-link svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: .8;
}

.rb-chat .msg-bubble .msg-inline-link span {
    display: inline;
    word-break: break-all;
}

.rb-chat .msg-row.me .msg-bubble .msg-inline-link {
    color: rgba(255, 255, 255, .96);
}

.rb-chat .msg-row:not(.me) .msg-bubble {
    border-radius: 3px 12px 12px 12px;
}

.rb-chat .msg-row.me .msg-bubble {
    background: var(--p);
    color: var(--p-contrast);
    border-radius: 14px 3px 14px 14px;
}

.rb-chat .msg-bubble-deleted {
    background: rgba(107, 114, 128, .12) !important;
    color: var(--text3) !important;
}

.rb-chat .msg-row.is-deleted .msg-meta {
    opacity: .8;
}

.rb-chat .msg-img,
.rb-chat .msg-video {
    max-width: 210px;
    border-radius: 12px;
    display: block;
}

.rb-chat .msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    max-width: 210px;
}

.rb-chat .msg-file:visited {
    color: var(--text);
}

.rb-chat .msg-row.me .msg-file {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.rb-chat .msg-row.me .msg-file:visited {
    color: #fff;
}

.rb-chat #admin-msgs .msg-row.me .msg-file {
    background: var(--surface);
    color: var(--text);
}

.rb-chat #admin-msgs .msg-row.me .msg-file:visited {
    color: var(--text);
}

.rb-chat .msg-file svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.rb-chat .msg-file-name {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    color: inherit;
}

.rb-chat .msg-file-size {
    font-size: 11px;
    color: var(--text3);
}

.rb-chat .msg-row.me .msg-file-size {
    color: rgba(255, 255, 255, .78);
}

.rb-chat #admin-msgs .msg-row.me .msg-file-size {
    color: var(--text3);
}

[data-theme="dark"] .rb-chat #admin-msgs .msg-row.me .msg-file {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

[data-theme="dark"] .rb-chat #admin-msgs .msg-row.me .msg-file:visited {
    color: #fff;
}

[data-theme="dark"] .rb-chat #admin-msgs .msg-row.me .msg-file-size {
    color: rgba(255, 255, 255, .78);
}

.rb-chat .msg-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.rb-chat .msg-row.me .msg-meta {
    flex-direction: row-reverse;
}

.rb-chat .msg-time {
    font-size: 11px;
    color: var(--text3);
}

.rb-chat .msg-unread {
    font-size: 11px;
    color: var(--p-soft-text);
}

.rb-chat .msg-date-divider {
    align-self: center;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(107, 114, 128, .12);
    color: var(--text3);
    font-size: 12px;
    line-height: 1;
}

.rb-chat .msg-del-btn {
    position: absolute;
    top: 50%;
    right: -26px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.rb-chat .msg-row.me .msg-del-btn {
    left: -26px;
    right: auto;
}

.rb-chat .msg-row:hover .msg-del-btn,
.rb-chat .msg-row.show-actions .msg-del-btn {
    opacity: 1;
    pointer-events: auto;
}

.rb-chat .system-msg {
    text-align: center;
    font-size: 11px;
    color: var(--text3);
    padding: 3px 0;
    white-space: pre-line;
    line-height: 1.6;
}

.rb-chat .typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 13px;
    color: var(--text3);
    flex-shrink: 0;
    background: var(--surface2);
}

.rb-chat .typing-dots {
    display: flex;
    gap: 3px;
}

.rb-chat .typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text3);
    border-radius: 50%;
    animation: rb-chat-bounce 1.2s infinite;
}

.rb-chat .typing-dots span:nth-child(2) {
    animation-delay: .2s;
}

.rb-chat .typing-dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes rb-chat-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

.rb-chat .chat-input-area {
    padding: 12px 12px;
    display: block;
    background: var(--surface);
    flex-shrink: 0;
    border-top: 1px solid var(--line);
}

.rb-chat .chat-input-area.disabled {
    opacity: .4;
    pointer-events: none;
}

.rb-chat .upload-progress {
    display: none;
    height: 3px;
    background: transparent;
    margin: -12px -12px 10px;
    border-radius: 999px;
    overflow: hidden;
}

.rb-chat .upload-progress.show {
    display: block;
}

.rb-chat .upload-progress-bar {
    width: 0;
    height: 100%;
    background: var(--p);
    border-radius: 999px;
    transition: width .12s linear;
}

.rb-chat .chat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0;
}

.rb-chat .chat-input-wrap textarea {
    flex: 1;
    background: var(--surface2);
    border: none !important;
    outline: none;
    border-radius: 10px;
    padding: 11px 13px !important;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    height: 42px;
    max-height: 92px;
    resize: none;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rb-chat .chat-input-wrap textarea::-webkit-scrollbar {
    display: none;
}

.rb-chat .chat-input-wrap textarea::placeholder {
    color: var(--text3);
}

.rb-chat .attach-btn {
    width: 42px;
    height: 42px;
    background: var(--surface2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    color: var(--text2);
}

.rb-chat .attach-btn.disabled,
.rb-chat .attach-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.rb-chat .send-btn {
    width: 42px;
    height: 42px;
    background: var(--p);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    color: #fff;
}

.rb-chat .attach-btn svg,
.rb-chat .send-btn svg {
    width: 16px;
    height: 16px;
}

.rb-chat #view-settings {
    position: absolute;
    left: 0;
    right: 0;
    top: 66px;
    bottom: 0;
    overflow-y: auto;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 10px;
    background: var(--surface2);
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 114, 128, .22) transparent;
    z-index: 25;
}

.rb-chat #view-settings::-webkit-scrollbar {
    width: 4px;
}

.rb-chat #view-settings::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, .22);
    border-radius: 999px;
}

.rb-chat #view-settings::-webkit-scrollbar-track {
    background: transparent;
}

.rb-chat #view-settings.open {
    display: flex;
}

.rb-chat .set-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
}

.rb-chat .set-label {
    font-size: var(--set-label-size);
    color: var(--text3);
}

.rb-chat .set-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rb-chat .set-help {
    font-size: var(--set-help-size);
    color: var(--text3);
}

.rb-chat .set-help-pre {
    font-size: var(--set-help-size);
    color: var(--text3);
    white-space: pre-line;
}

.rb-chat .set-inline-sep {
    font-size: var(--set-help-size);
    color: var(--text3);
}

.rb-chat .set-input {
    border: 1px solid var(--line) !important;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
    outline: none;
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    width: 100%;
}

.rb-chat .set-dim-input {
    width: 72px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 8px;
    font-size: 12px;
    outline: none;
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    text-align: right;
}

.rb-chat .set-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    background: transparent;
    cursor: pointer;
}

.rb-chat .set-range:focus {
    outline: none;
}

.rb-chat .set-range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: var(--line);
}

.rb-chat .set-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border: none;
    border-radius: 7px;
    background: var(--p);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}

.rb-chat .set-range::-moz-range-track {
    height: 4px;
    border: none;
    border-radius: 999px;
    background: var(--line);
}

.rb-chat .set-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 7px;
    background: var(--p);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}

.rb-chat .set-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    align-self: flex-start;
}

.rb-chat .set-divider {
    border: none;
    border-top: 1px solid var(--line);
}

.rb-chat .color-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rb-chat .color-dot {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

.rb-chat .color-dot.active {
    border-color: var(--text);
}

.rb-chat .segmented-control {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.rb-chat .segmented-control-wide {
    grid-template-columns: repeat(2, 1fr);
}

.rb-chat .seg-btn {
    height: 38px;
    border-radius: 9px;
    background: var(--surface2);
    border: none;
    color: var(--text2);
    font-size: 12px;
    cursor: pointer;
}

.rb-chat .seg-btn.active {
    background: var(--p-tint);
    color: var(--p-soft-text);
}

.rb-chat .token-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rb-chat .token-btn {
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--surface2);
    border: none;
    color: var(--text2);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    white-space: normal;
    opacity: 0.5
}

.rb-chat .token-btn.active {
    background: var(--p-tint);
    color: var(--p-soft-text);
    box-shadow: inset 0 0 0 1px rgba(88, 86, 214, .15);
    opacity: 1
}

.rb-chat .token-btn.risk {
    background: var(--surface2);
    color: var(--text2);
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .34);
    opacity: 0.5
}

.rb-chat .token-btn.risk.active {
    background: rgba(220, 38, 38, .16);
    color: #991b1b;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .22);
    opacity: 1;
}

[data-theme="dark"] .rb-chat .token-btn.risk {
    background: var(--surface2);
    color: var(--text2);
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .36);
}

[data-theme="dark"] .rb-chat .token-btn.risk.active {
    background: rgba(248, 113, 113, .18);
    color: #fecaca;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .26);
}

.rb-chat .token-group-ext .token-btn {
    justify-content: center;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.rb-chat .set-save,
.rb-chat .set-close {
    height: 38px;
    border-radius: 9px;
    border: none;
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
}

.rb-chat .set-save {
    background: var(--p);
    color: #fff;
}

.rb-chat .set-close {
    background: var(--surface2);
    color: var(--text);
}

.rb-chat .drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(88, 86, 214, .08);
    border: none;
    border-radius: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-size: 13px;
    color: var(--p);
    pointer-events: none;
}

.rb-chat #chat-panel.dragging .drop-overlay {
    display: flex;
}

[data-theme="dark"] .rb-chat .chat-spinner-box {
    background: rgba(28, 28, 31, .96);
    box-shadow: 0 20px 54px rgba(0, 0, 0, .45), 0 6px 16px rgba(0, 0, 0, .28);
}

.rb-chat .chat-modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.rb-chat .chat-modal-bg.open {
    display: flex;
}

.rb-chat .chat-modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
    width: 280px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rb-chat .chat-modal h4 {
    font-size: 14px;
    color: var(--text);
    margin-top: 0px;
    margin: 0px;
}

.rb-chat .chat-modal p {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.5;
    white-space: pre-line;
    margin: 0px;
}

.rb-chat .modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rb-chat .modal-btn {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    border: none;
    cursor: pointer;
}

.rb-chat .modal-cancel {
    background: var(--surface2);
    color: var(--text);
}

.rb-chat .modal-ok {
    background: var(--p);
    color: #fff;
}

.rb-chat .modal-danger {
    background: var(--status-err);
    color: #fff;
}

.rb-chat #img-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.rb-chat #img-modal.open {
    display: flex;
}

.rb-chat #img-modal img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    object-fit: contain;
}

.rb-chat .img-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, .15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rb-chat .profile-modal-bg {
    z-index: 220;
}

.rb-chat .profile-modal {
    width: 320px;
    position: relative;
    padding-top: 24px;
}

.rb-chat .profile-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--surface2);
    color: var(--text2);
    font-size: 15px;
    cursor: pointer;
}

.rb-chat .profile-photo-wrap {
    display: flex;
    justify-content: center;
}

.rb-chat .profile-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--p-tint);
    color: var(--p-soft-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.rb-chat .profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rb-chat .profile-name {
    text-align: center;
    font-size: 16px;
    color: var(--text);
}

.rb-chat .profile-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rb-chat .profile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface2);
    font-size: 12px;
}

.rb-chat .profile-row span {
    color: var(--text3);
}

.rb-chat .profile-row strong {
    color: var(--text);
    text-align: right;
    word-break: break-all;
}

@media (max-width:1024px) {
    .rb-chat #chat-fab {
        --button-x: 20px;
        display: var(--button-display-mobile, flex);
    }
}

@media (max-width:768px) {
    .rb-chat #chat-panel {
        inset: 0;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        right: auto;
        left: 0;
        bottom: 0;
        top: 0;
        border-radius: 0;
    }

    .rb-chat .profile-modal {
        width: min(320px, calc(100vw - 32px));
    }
}

@keyframes rb-chat-spin {
    to {
        transform: rotate(360deg);
    }
}
