@charset "utf-8";

/* ========== Front floating consult (purple CS) ========== */
.consult-launcher {
    position: fixed;
    right: 18px;
    bottom: 90px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.consult-launcher-label {
    color: #8b5cf6;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
#consult_fab {
    position: relative;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(124, 58, 237, .35);
    line-height: 0;
}
#consult_fab .consult-fab-face,
#consult_fab .consult-fab-face svg {
    display: block;
    width: 56px;
    height: 56px;
}
#consult_fab .consult-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    display: none;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
#consult_fab.has-unread .consult-fab-badge {
    display: inline-block;
}

#consult_panel {
    position: fixed;
    right: 18px;
    bottom: 170px;
    z-index: 10060;
    width: 340px;
    max-width: calc(100vw - 24px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid #e8e4f0;
    border-radius: 10px;
    box-shadow: 0 18px 42px rgba(70, 40, 120, .22);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
#consult_panel.is-open {
    display: flex;
}

.consult-panel-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f4f1f8;
    border-bottom: 1px solid #ebe6f2;
}
.consult-hd-agent {
    display: flex;
    align-items: center;
    gap: 10px;
}
.consult-hd-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8e0f5;
    flex: 0 0 auto;
}
.consult-hd-avatar img,
.consult-hd-avatar svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.consult-hd-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.consult-hd-text strong {
    font-size: 15px;
    color: #222;
}
.consult-hd-text span {
    font-size: 12px;
    color: #888;
}
.consult-panel-hd #consult_close {
    border: 0;
    background: transparent;
    color: #999;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.consult-msg-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 12px;
    background: #fff;
}

.consult-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
    width: fit-content;
    max-width: 92%;
}
.consult-msg.admin {
    margin-right: auto;
    margin-left: 0;
}
.consult-msg.mine {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row;
    justify-content: flex-end;
}
.consult-msg-avatar {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #eee;
}
.consult-msg-avatar img,
.consult-msg-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.consult-msg-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: calc(100% - 44px);
}
.consult-msg.mine .consult-msg-main {
    align-items: flex-end;
}
.consult-msg-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.2;
    width: 100%;
}
.consult-msg.mine .consult-msg-name {
    text-align: right;
}
.consult-msg .bubble {
    display: inline-block;
    max-width: 100%;
    padding: 9px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #ececec;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    color: #222;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    box-sizing: border-box;
    text-align: left;
}
.consult-msg.mine .bubble {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.consult-msg.admin .bubble {
    background: #fff;
    border-bottom-left-radius: 4px;
}
.consult-msg .bubble img {
    display: block;
    max-width: 180px;
    border-radius: 8px;
}
.consult-msg .meta {
    margin-top: 4px;
    font-size: 11px;
    color: #bbb;
}
.consult-msg.mine .meta {
    text-align: right;
    color: #aaa;
}

.consult-send-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}
.consult-send-box input[type="text"] {
    flex: 1 1 auto;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}
.consult-send-box input[type="text"]:focus {
    border-color: #b39ddb;
}
.consult-cam {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #5a5a5a;
    color: #fff;
    cursor: pointer;
}
.consult-send-box #consult_send {
    flex: 0 0 64px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: #a78bfa;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.consult-send-box #consult_send:hover {
    background: #8b5cf6;
}
.consult-send-box #consult_send:disabled,
.consult-cam input:disabled + svg {
    opacity: .5;
    cursor: not-allowed;
}

.consult-empty {
    padding: 40px 12px;
    text-align: center;
    color: #999;
    font-size: 13px;
    line-height: 1.6;
}

/* ========== Admin console (3 columns) ========== */
.consult-console {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    gap: 0;
    height: calc(100vh - 155px);
    max-height: calc(100vh - 155px);
    min-height: 480px;
    border: 1px solid #d8d8d8;
    background: #f3f3f3;
    overflow: hidden;
    box-sizing: border-box;
}
.consult-console > .cc-side,
.consult-console > .cc-chat {
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    height: 100%;
}
.cc-side {
    background: #fff;
    display: flex;
    flex-direction: column;
}
.cc-rooms {
    border-right: 1px solid #ddd;
    overflow: hidden;
}
.cc-info {
    border-left: 1px solid #ddd;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #f7f7f7;
    padding-bottom: 24px;
    box-sizing: border-box;
}
.cc-side-hd {
    flex: 0 0 auto;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
}
.cc-room-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.cc-room {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    background: #fff;
}
.cc-room:hover {
    background: #f9f9f9;
}
.cc-room.is-active {
    background: #2d2d2d;
    color: #fff;
    box-shadow: inset 3px 0 0 #4caf50;
}
.cc-room-main {
    flex: 1;
    min-width: 0;
}
.cc-room-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-room-sub {
    margin-top: 3px;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-room.is-active .cc-room-sub {
    color: #bbb;
}
.cc-room-unread {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    vertical-align: middle;
}
.cc-btn-del {
    flex: 0 0 auto;
    border: 0;
    background: #e53935;
    color: #fff;
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 3px;
    cursor: pointer;
}
.cc-chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #eceff1;
}
.cc-chat-hd {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
.cc-chat-hd strong {
    font-size: 15px;
}
.cc-btn-leave {
    border: 0;
    background: #e53935;
    color: #fff;
    padding: 6px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.cc-msg-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}
.cc-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    width: fit-content;
    max-width: 88%;
    clear: both;
    box-sizing: border-box;
}
.cc-msg.member {
    margin-right: auto;
    margin-left: 0;
}
.cc-msg.admin {
    margin-left: auto;
    margin-right: 0;
}
.cc-msg-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #ddd;
}
.cc-msg-avatar img,
.cc-msg-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.cc-msg-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: calc(100% - 48px);
}
.cc-msg.admin .cc-msg-main {
    align-items: flex-end;
}
.cc-msg-name {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    line-height: 1.2;
    text-align: left;
    width: 100%;
}
.cc-msg.admin .cc-msg-name {
    text-align: right;
}
.cc-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    box-sizing: border-box;
    text-align: left;
}
.cc-msg.admin .cc-bubble {
    background: #e8f5e9;
    border-color: #c8e6c9;
}
.cc-bubble img {
    display: block;
    max-width: 220px;
    border-radius: 6px;
}
.cc-msg-time {
    margin-top: 4px;
    font-size: 11px;
    color: #999;
    width: 100%;
}
.cc-msg.admin .cc-msg-time {
    text-align: right;
}
.cc-msg-del {
    margin-top: 6px;
    border: 0;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1.4;
}
.cc-msg-del:hover {
    background: #c62828;
}
.cc-send {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
}
.cc-send input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0 12px;
    font-size: 13px;
    box-sizing: border-box;
}
.cc-cam {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}
.cc-btn-send {
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 4px;
    background: #43a047;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.cc-card {
    margin: 10px;
    background: #fff;
    border: 1px solid #ddd;
    overflow: visible;
}
.cc-card-hd {
    padding: 8px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.cc-hd-green { background: #43a047; }
.cc-hd-blue { background: #1e88e5; }
.cc-hd-teal { background: #00897b; }
.cc-card-bd {
    padding: 12px;
    overflow: visible;
}
.cc-card-bd dl {
    margin: 0;
    padding: 0;
    display: block;
    font-size: 13px;
    line-height: 1.45;
}
.cc-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
}
.cc-info-row:last-child {
    margin-bottom: 0;
}
.cc-card-bd dt {
    flex: 0 0 48px;
    margin: 0;
    color: #777;
    font-weight: 400;
}
.cc-card-bd dd {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-weight: 600;
    color: #222;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}
.cc-avatar-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
.cc-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cc-avatar-fallback {
    font-size: 12px;
    color: #888;
}
.cc-avatar-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cc-mini-btn {
    display: inline-block;
    border: 1px solid #ccc;
    background: #f5f5f5;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
}
.cc-field {
    display: block;
    margin-bottom: 10px;
}
.cc-field span {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #666;
}
.cc-field input,
.cc-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 7px 8px;
    font-size: 13px;
}
.cc-btn-save {
    width: 100%;
    border: 0;
    background: #43a047;
    color: #fff;
    padding: 9px 0;
    border-radius: 3px;
    font-weight: 700;
    cursor: pointer;
}
.cc-empty {
    padding: 30px 14px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Admin top badge (shared) */
#tnb .tnb_consult a {
    position: relative;
    display: inline-block;
    padding: 0 8px;
    color: #fff;
    font-weight: 700;
}
#tnb .tnb_consult .consult-admin-badge {
    display: none;
    margin-left: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    vertical-align: middle;
}
#tnb .tnb_consult.has-unread .consult-admin-badge {
    display: inline-block;
}

@media screen and (max-width: 1200px) {
    .consult-console {
        grid-template-columns: 200px minmax(0, 1fr) 280px;
        height: calc(100vh - 155px);
        max-height: calc(100vh - 155px);
    }
}
@media screen and (max-width: 900px) {
    html,body,#wrapper,#container{overflow:auto!important;height:auto!important;}
    #ft{display:block!important;}
    .consult-console {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }
    .consult-console > .cc-side,
    .consult-console > .cc-chat {
        height: auto;
        max-height: none;
    }
    .cc-rooms { max-height: 240px; }
    .cc-chat { height: 520px; max-height: 520px; }
    .cc-info {
        max-height: none;
        overflow: visible;
        padding-bottom: 16px;
    }
}
@media screen and (max-width: 1090px) {
    .consult-launcher {
        right: 12px;
        bottom: 80px;
    }
    #consult_panel {
        right: 8px;
        left: 8px;
        bottom: 160px;
        width: auto;
        height: 58vh;
    }
}
