/**
 * 伙伴·技能·知识库 - 组件样式
 * 伙伴Tab：管理列表页（CustomList 卡片网格、分页、搜索）
 * 技能/知识库Tab：占位页样式
 */

/* ==================== 伙伴列表页 ==================== */

/* 伙伴/智能体列表 CustomList 卡片网格（与技能 #skill-list-table 同款：自适应列、宽屏约5列） */
#esk-partner-list-table,
#esk-assistant-list-table {
    display: grid;
    /* 自适应列数：卡片最小240px，宽屏4列、小屏自动降为3/2/1列 */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 16px 20px;
    overflow-y: auto;
    background: #fff;
}

/* 伙伴卡片：白色圆角 + 灰色边框（与技能一致） */
.esk-expert-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    box-sizing: border-box;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.esk-expert-card:hover {
    border-color: #4D6BFE;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* 卡片右上角三点更多按钮 */
.esk-card-more {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s;
    z-index: 1;
}
.esk-card-more:hover {
    background: #f2f3f5;
}
.esk-card-more span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #999;
}
.esk-card-more:hover span {
    background: #333;
}

/* 卡片右上角 编辑/删除（悬浮显示，缩小样式，与连接器一致） */
.esk-card-ops {
    position: absolute;
    top: 11px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity .2s;
    z-index: 1;
}
.esk-expert-card:hover .esk-card-ops {
    opacity: 1;
}
.esk-card-op {
    font-size: 11px;
    color: #3855d5;
    cursor: pointer;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}
.esk-card-op:hover {
    background: #f0f3ff;
}
.esk-op-del {
    color: #e34d59;
}
.esk-op-del:hover {
    background: #fef0f0;
}

/* 伙伴卡片：右上角常驻操作（详情/使用，直接显示无需悬浮） */
.esk-partner-ops {
    top: 18px;
    right: 12px;
    left: auto;
    opacity: 1;
}

/* 上部主体：左侧圆形头像 + 右侧信息列（名称、职称、简介） */
.esk-card-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
    flex: 1;
}

/* 圆形头像（无图时显示名称首字，背景色由内联样式控制；44px 与技能/连接器卡片统一） */
.esk-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}
.esk-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 右侧信息列 */
.esk-card-info {
    flex: 1;
    min-width: 0; /* 子元素 ellipsis 依赖 */
}

/* 伙伴名称 */
.esk-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    padding-right: 30px; /* 避让右上角三点按钮 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 简介（两行截断，13px/#666 与技能/连接器卡片统一） */
.esk-card-desc {
    font-size: 13px;
    color: #666;
    line-height: 20px;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}

/* 卡片底部统计：技能数量、知识库数量、播放统计 */
.esk-card-stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

/* ==================== 智能体Tab卡片（复用伙伴卡片结构，风格统一） ==================== */

/* 智能体列表 CustomList 卡片网格（与伙伴/连接器一致：4列） */
#agent-manager-list-table,
#agent-manager-list-menu-table {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px 20px;
    overflow-y: auto;
    background: #fff;
}

/* 名称行：名称（截断）+ 账号类型标签 */
.esk-card-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding-right: 36px; /* 避让右上角...按钮 */
}
.esk-card-name-text {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.esk-card-tag {
    flex-shrink: 0;
    display: inline-block;
    font-size: 11px;
    color: #597EF7;
    background: #F0F5FF;
    padding: 0 6px;
    border-radius: 3px;
    line-height: 18px;
    white-space: nowrap;
}
/* 医生伙伴标识（卡片名称旁） */
.esk-card-tag-doctor {
    color: #52c41a;
    background: #f6ffed;
}
/* 复制伙伴标识（copy） */
.esk-card-tag-copy {
    color: #fa8c16;
    background: #fff7e6;
}

/* ==================== 伙伴卡片分组分割（医生伙伴 / 我的伙伴·素人伙伴） ==================== */

/* 分组分割标题：占满整行（左侧组名 + 右侧延伸分割线） */
.esk-card-group-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 2px 0;
}
.esk-card-group-text {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.esk-card-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

/* 智能体卡片操作与伙伴一致（esk-partner-ops 常驻右上），无独立定位覆盖 */

/* ==================== 伙伴详情弹窗 ==================== */
.esk-detail-box {
    padding: 5px 10px 2px;
}
.esk-detail-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}
.esk-detail-info {
    min-width: 0;
}
.esk-detail-name {
    font-size: 17px;
    font-weight: 600;
    color: #333;
}
.esk-detail-sub {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}
.esk-detail-row {
    margin-bottom: 14px;
}
.esk-detail-label {
    font-size: 13px;
    color: #999;
    margin-bottom: 6px;
}
.esk-detail-value {
    font-size: 14px;
    color: #333;
    line-height: 22px;
    word-break: break-all;
}

/* ==================== 占位内容卡片（技能/知识库Tab） ==================== */

/* 占位内容卡片（居中展示，高度自适应视口：100vh - tab头48px - 内边距） */
.esk-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
    background: #fff;
    border-radius: 10px;
    text-align: center;
}
.esk-placeholder-icon {
    width: 72px;
    height: 72px;
    line-height: 72px;
    border-radius: 50%;
    background: #f0f5ff;
    font-size: 32px;
    margin-bottom: 16px;
}
.esk-placeholder-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.esk-placeholder-desc {
    font-size: 13px;
    color: #888;
    line-height: 22px;
    max-width: 420px;
}
.esk-placeholder-tag {
    display: inline-block;
    margin-top: 16px;
    font-size: 12px;
    color: #597EF7;
    background: #F0F5FF;
    padding: 2px 10px;
    border-radius: 10px;
}

/* ==================== 知识库左侧竖向tab占位内容 ==================== */
.esk-kb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: calc(100vh - 120px);
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: #888;
}

/* ==================== 伙伴表单抽屉 ==================== */

/* 伙伴抽屉·人物信息Tab基础信息表单（图标+名称+描述，编辑器上方） */
.eskf-form-fields {
    margin-bottom: 12px;
}

/* 头像图标上传（居中，圆形占位，图片类型 icon） */
.eskf-icon-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
}
.eskf-icon-upload {
    position: relative;
    width: 96px;
    height: 96px;
    border: 1px dashed #d0d0d0;
    border-radius: 50%;
    background: #fafafa;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s;
}
.eskf-icon-upload:hover {
    border-color: #3855d5;
}
.eskf-icon-upload.has-icon {
    border-style: solid;
}
.eskf-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}
.eskf-icon-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}
.eskf-icon-add-symbol {
    font-size: 26px;
    line-height: 1;
    color: #bbb;
}
.eskf-icon-add-text {
    font-size: 12px;
    margin-top: 4px;
    color: #999;
}
.eskf-icon-del {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: none;
    z-index: 2;
}
.eskf-icon-upload.has-icon .eskf-icon-del {
    display: block;
}
.eskf-icon-tip {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}
.eskf-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.eskf-field:last-child {
    margin-bottom: 0;
}
.eskf-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
    width: 60px;
    text-align: right;
}
.eskf-field-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background: #fff;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}
.eskf-field-input:focus {
    border-color: #3855d5;
    box-shadow: 0 0 0 2px rgba(56, 85, 213, .08);
}
/* 描述textarea：label顶对齐、可纵向拉伸 */
.eskf-field-top {
    align-items: flex-start;
}
.eskf-field-top .eskf-field-label {
    line-height: 34px;
}
.eskf-field-textarea {
    flex: 1;
    min-width: 0;
    min-height: 58px;
    padding: 7px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background: #fff;
    outline: none;
    resize: vertical;
    transition: border-color .2s;
    box-sizing: border-box;
    font-family: inherit;
}
.eskf-field-textarea:focus {
    border-color: #3855d5;
    box-shadow: 0 0 0 2px rgba(56, 85, 213, .08);
}

/* 伙伴抽屉顶部名称信息区（伙伴名称输入 + 素人伙伴提示） */
.eskf-partner-base {
    padding: 14px 6px 4px;
    flex-shrink: 0;
}
.eskf-base-tip {
    font-size: 12px;
    color: #999;
    margin: -4px 0 0 72px;
    padding-bottom: 2px;
}

/* 技能Tab顶部：下拉筛选 + 描述 + 已选数量 */
.eskf-skill-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    height: 56px;
    box-sizing: border-box;
}
.eskf-skill-count {
    font-size: 12px;
    color: #3855d5;
    font-weight: 600;
    flex-shrink: 0;
}
/* 技能提示词勾选引导（"已选择 0 个"旁） */
.eskf-skill-tip {
    font-size: 12px;
    color: #999;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 技能列表区（滚动） */
.eskf-skill-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: #fff;
    margin-top: 10px;
    border-radius: 8px;
}
.eskf-skill-loading,
.eskf-skill-empty {
    padding: 40px 0;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* 技能条目：左侧复选框 + 右侧(title/desc) + 分割线 */
.eskf-skill-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background .2s;
}
.eskf-skill-item:last-child {
    border-bottom: none;
}
.eskf-skill-item:hover {
    background: #f8f9ff;
}

/* 勾选框（隐藏原生，用自定义勾选样式） */
.eskf-skill-item .eskf-skill-check {
    display: none;
}
.eskf-skill-item .eskf-skill-checkmark {
    width: 18px;
    height: 18px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    box-sizing: border-box;
    transition: all .2s;
}
.eskf-skill-item .eskf-skill-check:checked + .eskf-skill-checkmark {
    background: #3855d5;
    border-color: #3855d5;
}
.eskf-skill-item .eskf-skill-check:checked + .eskf-skill-checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 技能条目右侧：标题 + 描述 */
.eskf-skill-item .eskf-skill-right {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.eskf-skill-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.eskf-skill-desc-item {
    font-size: 12px;
    color: #888;
    line-height: 18px;
    margin-top: 4px;
    word-break: break-all;
}

/* 抽屉底部全局保存条（不再放在技能Tab内，任意Tab下均可保存；按钮靠左） */
.eskf-drawer-footer {
    flex-shrink: 0;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 8px;
    box-sizing: border-box;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}
.eskf-save-btn {
    padding: 9px 40px;
    font-size: 14px;
    color: #fff;
    background: #3855d5;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s;
}
.eskf-save-btn:hover {
    background: #2c46c4;
}

/* 训练记录空态（新建伙伴默认无训练记录） */
.eskf-record-empty {
    padding: 80px 0;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* ==================== 技能Tab 复用 SkillManager（伙伴抽屉内） ==================== */

/* 让嵌入的技能列表占满滚动态 */
#expert-form-skill-picker {
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}
#expert-form-skill-picker .material-list-container {
    height: 100%;
}
#expert-form-skill-picker .CU-table-list,
#expert-form-skill-picker .CU-list-tab-content,
#expert-form-skill-picker .CU-list-search,
#expert-form-skill-picker .CU-list-container {
    width: 100% !important;
}

/* 顶部椭圆(胶囊)筛选：全部 / 我的 —— 仅作用于抽屉内技能列表 */
#expert-form-skill-picker .CU-search-card-option {
    display: inline-block;
    height: 28px;
    line-height: 26px;
    padding: 0 16px;
    margin-left: 4px;
    border-radius: 999px;
    background: #f5f6fa;
    color: #666;
    font-size: 13px;
    border: 1px solid transparent;
    transition: all .2s;
    white-space: nowrap;
}
#expert-form-skill-picker .CU-search-card-option:hover {
    color: #3855d5;
    background: #eef2ff;
}
#expert-form-skill-picker .CU-search-card-option.active {
    background: #3855d5;
    color: #fff;
    font-weight: 600;
}

/* 知识库左侧Tab（文档/云盘）：分割竖线延伸到底部（header默认随内容高，与内容区不等高时线很短） */
.CU-tabs-vertical[id^="tabs-knowledge"] {
    align-items: stretch;
}
.CU-tabs-vertical[id^="tabs-knowledge"] .CU-tabs-header {
    height: auto;
}
.CU-table-medium {
  
}
/* 知识库->文档/云盘：页面内容统一白底（覆盖表格体灰底与表头 .is-bg 灰底 #f5f5f5） */
[id^="kb-doc-tab-content"] .CU-list-table,
[id^="kb-disk-tab-content"] .CU-list-table,
[id^="kb-doc-tab-content"] .CU-list-table thead.is-bg,
[id^="kb-disk-tab-content"] .CU-list-table thead.is-bg {
    background: #fff;
}
/* ==================== 灰底白卡片布局（伙伴/智能体/技能/MCP/知识库 Tab统一） ==================== */
/* 效果目标：整个模块区域一律灰底，内容装在白色圆角卡片里，灰白分明 */

/* 1) 模块整体刷灰（含tab头区域），高度撑满右侧内容区（.right 高100%，这里铺满它） */
#menu-content-wrap-expert {
    background: #FFF;
    min-height: 100%;
    box-sizing: border-box;
}

/* 2) tabs根/内容区/面板全部透明，统一露出灰底（!important 覆盖面板内联 background 与根节点内联阴影） */
#menu-content-wrap-expert .CU-tabs,
#menu-content-wrap-expert .CU-tabs-content,
#menu-content-wrap-expert .CU-tab-pane {
    background: transparent !important;
    box-shadow: none !important;
}

/* 3) tab头浮在灰底上：去掉通栏底边线（"线条感"来源之一）；内联 style 需 !important 覆盖 */
#menu-content-wrap-expert .CU-tabs-header {
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}


/* 5) 灰白布局核心：列表区域（CU-list-table）本身透出灰色底，一张张内容卡片白色浮在上面；
   工具栏（筛选/搜索/新建按钮）独立成一张白色圆角卡片。
   （只改观感：纵向尺寸全部不变，避免影响 CustomList 固定布局高度计算） */
[id^="expert-tab-content-1"] .CU-list-search,
[id^="expert-tab-content-4"] .CU-list-search,
[id^="expert-tab-content-2"] .CU-list-search {
    background: #fff;
    border-radius: 10px;
    padding-left: 16px;
    padding-right: 16px;
    box-shadow: 0 1px 6px rgba(17, 31, 88, 0.06);
}

/* 列表容器/表格区：透明 → 灰色画布 */
[id^="expert-tab-content-1"] .CU-list-container,
[id^="expert-tab-content-4"] .CU-list-container,
[id^="expert-tab-content-2"] .CU-list-container {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* 分页条：透明浮在灰底上 */
[id^="expert-tab-content-1"] .CU-list-pagination,
[id^="expert-tab-content-4"] .CU-list-pagination,
[id^="expert-tab-content-2"] .CU-list-pagination {
    background: transparent;
}

/* 6) 容器透明化：chat_new.css 的 .material-list-container（后加载）会铺白底盖住灰底，必须透明
   （含技能Tab内部嵌套的同名容器） */
#menu-content-wrap-expert [id^="expert-tab-content-1"],
#menu-content-wrap-expert [id^="expert-tab-content-2"],
#menu-content-wrap-expert [id^="expert-tab-content-3"],
#menu-content-wrap-expert [id^="expert-tab-content-4"],
#menu-content-wrap-expert [id^="connector-tab-content"],
#menu-content-wrap-expert [id^="kb-doc-tab-content"],
#menu-content-wrap-expert [id^="kb-disk-tab-content"],
#menu-content-wrap-expert [id^="skill-tab-content-1"],
#menu-content-wrap-expert [id^="skill-tab-content-2"] {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* 7) 卡片网格自身不再铺白底（容器卡片已提供白色面板） */
[id^="expert-tab-content-1"] #esk-partner-list-table,
[id^="expert-tab-content-4"] #esk-assistant-list-table {
    background: transparent;
    padding: 16px;
}

/* 8) 伙伴/智能体卡片：去描边，改浅阴影（灰白分明更柔和） */
[id^="expert-tab-content-1"] .esk-expert-card,
[id^="expert-tab-content-4"] .esk-expert-card {
    border: none;
    box-shadow: 0 1px 4px rgba(17, 31, 88, 0.08);
}
[id^="expert-tab-content-1"] .esk-expert-card:hover,
[id^="expert-tab-content-4"] .esk-expert-card:hover {
    background: #f5f5f5;
    cursor: pointer;
}

/* 技能/连接器(MCP)卡片：与伙伴/智能体卡片统一去描边、改浅阴影 */
#menu-content-wrap-expert .skill-card-item,
#menu-content-wrap-expert .cam-card {
    border: none;
    box-shadow: 0 1px 4px rgba(17, 31, 88, 0.08);
}
#menu-content-wrap-expert .skill-card-item:hover,
#menu-content-wrap-expert .cam-card:hover {
    background: #f5f5f5;
    cursor: pointer;
}

