:root {
    --wk-width-max-message: 540px;
}

.wk-message-base {
    width: 100%;
    height: 100%;
    display: flex;
}

.wk-message-base-check-open {

}

.wk-message-base-send, .wk-message-base-recv {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}


.wk-message-base-send {
    /* 发送消息也靠左对齐,和接收消息布局一致 */
    margin-left: 15px;
}

.wk-message-base-recv {
    margin-left: 15px;
    transform: translate3d(0, 0, 0);
    transition: transform var(--wk-layer-transition);
}

.wk-message-base-check-open .wk-message-base-recv {
    transform: translate3d(30px, 0, 0);
}

/* .senderName 已废弃，由 .wk-msg-head 取代 */

/* ── 头像（flex item，非 absolute） ── */
.senderAvatar {
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

.senderAvatar-placeholder {
    cursor: default;
    height: auto;
}

.senderAvatar img {
    width: 32px;
    height: 32px;
}

/* ── 消息行容器 ── */
.wk-message-base-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.wk-message-base-send .wk-message-base-box {
    flex-direction: row;
}

/* 自己的消息也显示头像（通过 row-reverse 位于右侧） */

/* ── 消息体列（head + bubble） ── */
.wk-msg-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.wk-message-base-send .wk-msg-body {
    align-items: flex-start;
}

/* ── Head 行（name + time，在气泡外面） ── */
.wk-msg-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.wk-msg-head-right {
    justify-content: flex-end;
}

.wk-msg-head-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.wk-msg-head-time {
    font-size: 11px;
    color: var(--wk-text-tertiary, rgba(9,30,66,.54));
    white-space: nowrap;
    flex-shrink: 0;
}

/* 外部群成员消息头「来源」行（由 .wk-msg-head-space 行内替代） */
.wk-msg-head-origin {
    margin-top: 0;
    margin-bottom: 4px;
}

/* 消息气泡头部「@SpaceName」后缀，紧随昵称展示，小字次要色 */
.wk-msg-head-space {
    font-size: 12px;
    font-weight: var(--wk-font-regular, 400);
    color: var(--semi-color-text-2, var(--wk-text-secondary, rgba(9, 30, 66, 0.6)));
    line-height: 1.3;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

/* ── Bubble box ── */
.wk-message-base-bubble-box {
    display: flex;
    position: relative;
}

.wk-message-base-bubble-box.recv {
    /* 不再需要 margin-left，头像已是 flex item */
}

.wk-message-base-bubble {
    color: var(--wk-text-primary, rgba(9,30,66,.87));
    display: flex;
    padding: 8px 12px;
    position: relative;
    word-wrap: break-word;
    max-width: 480px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.65;
}

.wk-message-base-bubble-box.hide .wk-message-base-bubble {
    padding: 0px;
}

@media screen and (max-width: 640px)  {
    .wk-message-base-bubble {
        max-width: calc(100vw - 80px);
    }
}

/* ── Sec7: 自己的消息（右对齐，淡青） ── */
.wk-message-base-bubble-box.send .wk-message-base-bubble {
    background-color: var(--wk-bg-self);
    border-radius: var(--wk-r-lg) 2px var(--wk-r-lg) var(--wk-r-lg);
    border: 1px solid rgba(0,180,148,0.12);
    color: var(--wk-text-primary, rgba(9,30,66,.87));
}

/* ── Sec6: 他人消息（左对齐，微紫白） ── */
.wk-message-base-bubble-box.recv .wk-message-base-bubble {
    border-radius: 2px var(--wk-r-lg) var(--wk-r-lg) var(--wk-r-lg);
    background-color: var(--wk-bg-bubble);
    border: 1px solid rgba(0,0,0,0.06);
    color: var(--wk-text-primary, black);
}

body[theme-mode=dark] .wk-message-base-bubble-box.recv .wk-message-base-bubble  {
    color: var(--wk-text-primary, white);
}

/* 连续消息：后续气泡全圆角（不再需要尖角指向头像） */
.wk-message-base-bubble-box.send.middle .wk-message-base-bubble,
.wk-message-base-bubble-box.send.first .wk-message-base-bubble {
    border-radius: var(--wk-r-lg);
}

.wk-message-base-bubble-box.recv.middle .wk-message-base-bubble,
.wk-message-base-bubble-box.recv.first .wk-message-base-bubble {
    border-radius: var(--wk-r-lg);
}

.wk-message-base-bubble-box.hide .wk-message-base-bubble {
    background-color: transparent !important;
    border: none;
}

/* ── Sec8: AI 消息面板 ── */

.wk-message-base-bubble-box.ai-panel .wk-message-base-bubble {
    display: block;
    max-width: min(680px, calc(100vw - 120px));
    background: var(--wk-ai-panel-bg);
    border-radius: var(--wk-r-lg);
    border: 1px solid var(--wk-ai-border);
    overflow: hidden;
    position: relative;
    padding: 0;
    line-height: 1.75;
}

/* AI 面板顶部品牌渐变线 */
.wk-message-base-bubble-box.ai-panel .wk-message-base-bubble::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--wk-brand-gradient);
    opacity: 0.6;
}

/* AI 面板头部（Agent 名 + AI 标签） */
.wk-message-base-bubble-box.ai-panel .wk-ai-panel-head {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.wk-message-base-bubble-box.ai-panel .wk-ai-panel-agent-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--wk-text-primary);
}

/* AI 面板内容区 */
.wk-message-base-bubble-box.ai-panel .wk-message-base-content {
    padding: 16px 20px;
    line-height: 1.75;
    font-size: 14px;
    height: auto;
}

/* AI 面板底栏 */
.wk-message-base-bubble-box.ai-panel .wk-ai-panel-foot {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: rgba(28,28,35,0.02);
}

.wk-message-base-bubble-box.ai-panel .wk-ai-panel-foot .messageTime {
    font-size: 11px;
    color: var(--wk-text-tertiary);
}

/* 子组件渲染的 textTitle 和 messageMeta 隐藏（已由 wk-msg-head / ai-panel-head/foot 取代） */
.wk-message-base-bubble .textTitle {
    display: none;
}

.wk-message-base-bubble .messageMeta {
    display: none;
}


/* SVG 尾巴已移除，v4 设计不再使用 */
.svgAppendix {
    display: none !important;
}

/* .wk-message-base-recv .wk-message-base-bubble {
    margin-left: 5px;
    background-color: #bedbf5;
}

.wk-message-base-send .wk-message-base-bubble {
    margin-right: 5px;
    background-color: #fff;
    box-shadow: -1px 1px 1px rgba(0,0,0,.12);
    color: rgba(9,30,66,.87) !important;
    border-radius: 20px 4px 8px 20px;
}*/



/* .messageNameBox 已废弃 */

/*.messageTime {
    color: rgba(9,30,66,.74);
    font-size: 12px;
    font-weight: 400;
    text-transform: capitalize;
    display: none;
}

.wk-message-base-send:hover .messageTime {
    display: block;
}

.wk-message-base-recv:hover .messageTime {
    display: block;
}

.wk-message-base-recv .messageTime {
    margin-left: 8px;
}

.wk-message-base-send .messageTime {
    margin-right: 8px;
}*/



.wk-message-base-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.popupMenusContaner {
    display: none;
}

.wk-message-base-box:hover .popupMenusContaner {
    display: block;
}


.wk-message-base-checkBox {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform: translate3d(-10px, 0, 0);
    transition: transform var(--wk-layer-transition);
}

.wk-message-base-check-open {
    cursor: pointer;
}

.wk-message-base-check-open .wk-message-base-checkBox{
    transform: translate3d(25px, 0, 0);
   
}

.wk-message-base-checkBox .wk-checkbox {
    position: absolute;
    bottom: 10px;
}

.wk-message-base-send .checkBox {
    left: auto;
    right: -30px;
}


.wk-message-base-send .wk-message-base-box.checked {
    margin-left: 0;
    margin-right: 30px;
}

.wk-message-base-recv .wk-message-base-box.checked .senderAvatar {
    left: -30px;
}

.replyBox {
    width: 100%;
}

.reply {
    position: relative;
    color: var(--wk-text-secondary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 12px;
    margin-bottom: 4px;
    max-width: 100%;
    white-space: pre-wrap;
    white-space: -moz-pre-wrap;
    white-space: -pre-wrap;
    white-space: -o-pre-wrap;
    word-wrap: break-word;
}

.reply::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    border-radius: 50px;
    background-color: var(--wk-color-theme);
}

.messageMeta {
    position: relative;
    top: 0.375rem;
    bottom: auto !important;
    float: right;
    line-height: 1;
    height: 19px;
    margin-left: 0.4375rem;
    margin-right: -0.2rem;
}

.wk-message-base-bubble-box.send .messageMeta {
    top: 0rem;
}

.messageTime {
    margin-inline-end: 0.1875rem;
    font-size: .75rem;
    white-space: nowrap;
}

.wk-message-base-bubble-box.recv .messageTime {
    color: rgb(104, 108, 114,0.75);
}

.wk-message-base-bubble-box.send .messageTime {
    color: rgb(104, 108, 114,0.75);
}

.textTitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: calc(var(--message-text-size, 1rem) - .125rem);
    font-weight: 500;
    color: var(--accent-color);
    unicode-bidi: plaintext;
    display: flex;
    flex-direction: column;
}

.textTitle-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

/* 外部群成员来源标识 */
/* 视觉与紫色「外部」Tag 对齐：小字、次要色，仅做来源提示用途。 */
.ext-origin {
    margin-top: 2px;
    font-size: var(--wk-text-size-sm);
    font-weight: var(--wk-font-regular);
    color: var(--semi-color-text-2);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-message-read::before {
    content: "";
    position: absolute;
    bottom: -4px;
    color: rgb(255,255,255,0.7);
}

.icon-message-succeeded::before {
    content: "";
    position: absolute;
    bottom: -4px;
    color: rgb(255,255,255,0.7);
}

.icon-message-pending::before {
    content: "";
    position: absolute;
    bottom: -4px;
}

.messageStatus {
    width: 1.19rem;
    height: 1.19rem;
    overflow: hidden;
    display: inline-block;
    line-height: 1;
    margin-left: -0.1875rem;
    font-size: 1.1875rem;
    border-radius: 0.625rem;
}

.messageFail {
    cursor: pointer;
}

.messageFail img {
    width: 20px;
    height: 20px;
    margin-left: 10px;
}

.wk-message-error-reason {
    font-size: 13px;
    margin-right: 10px;
    margin-top: 5px;
    color: var(--wk-color-font-tip);
}
/* 多选模式 */
.wk-message-selecting {
  cursor: pointer;
  padding-left: 44px;
  position: relative;
}

.wk-message-selected {
  background: rgba(28, 28, 35, 0.04);
  border-radius: 8px;
}

.wk-message-checkbox {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.wk-message-checkbox-inner {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid rgba(28, 28, 35, 0.25);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.wk-message-checkbox-inner--checked {
  background: #1C1C23;
  border-color: #1C1C23;
}
