/* ============================================================
 * aiPages.css —— 网站「侧栏功能按钮 + 右侧功能页」布局（对齐电商助手桌面端）
 *
 * 设计红线：
 *  - 顶部导航栏（.header）保持不动
 *  - 底部共享办公区（.office-section）保持不动
 *  - 现有功能按钮不删
 * 新增：
 *  - 左侧固定侧栏（品牌区 52px 与 .header 等高，下方 6 个胶囊功能按钮）
 *  - 右侧 #function-page-container 功能页容器（与 #mainContent 同级，切换显隐）
 *  - 5 个 AI 功能页：AI助手 / 图片创作 / 视频创作 / 素材检测 / 电商自动化
 * ============================================================ */

/* ── 全局：让 .app 给固定侧栏让出左侧 200px（body 已 padding-top:100px 顶栏）── */
html.tc-with-sidebar {
    /* 顶部导航栏仍占满宽度；侧栏在导航栏下方固定 */
}

/* ── 左侧固定侧栏（桌面端常显，顶部导航栏下方）──
   ★ 独立悬浮区：四周留灰底间隙 + 圆角 + 投影，灰渐变面板浮在页面上方（对齐电商助手 .sidebar-fixed） */
.tc-sidebar {
    position: fixed;
    top: var(--app-top, 72px);  /* ★ 与功能区同源：JS(layoutSidebarTop) 实测 header 高 + 12 写入 --app-top，并内联覆盖 top；此值为 JS 未跑时的兜底，保证任何显示器尺寸下侧栏与功能区顶缝一致 */
    left: 12px;         /* ★ 统一 12px 间距（原 8px 与其他边不统一） */
    width: 188px;       /* ★ 右缘=200，与内容面板(left 212)之间保持 12px 统一灰缝 */
    bottom: 12px;
    z-index: 1300;      /* ★ 高于 Zone2 固定展示区 office(1200)/footer(1201)，侧栏按钮恒在最上层不被拦截 */
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px;
    /* ★ 悬浮对比度增强（用户反馈看不出悬浮效果）：
       灰底加深一档与白色页面/胶囊拉开层次 + 1px 描边锁定轮廓 + 阴影加强 */
    background: linear-gradient(180deg, #eef2f8 0%, #dce4ef 100%);
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 16px;       /* ★ 圆角悬浮面板 */
    box-shadow: 0 16px 36px rgba(15,23,42,0.18), 0 3px 10px rgba(15,23,42,0.12), inset 0 1px 0 rgba(255,255,255,0.8);  /* ★ 灰调悬浮投影 + 内高光 */
    overflow: hidden;
    box-sizing: border-box;
}

.tc-sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(0,0,0,0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px 4px;
}
/* ★ 按钮间距：.tc-sidebar 的 gap 只作用于直接子，#tcSidebarNav 内的按钮
   需单独设 flex + 安全间距，避免全部粘在一起 */
#tcSidebarNav {
    display: flex;
    flex-direction: column;
    gap: 8px;            /* ★ 对齐电商助手 .sidebar-nav gap:8px（原 14px 间距过大） */
    padding-top: 4px;
}
.tc-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 15px;    /* ★ 对齐电商助手 .nav-item 15px（原 14px 偏小） */
    font-weight: 500;
    color: rgba(0,0,0,0.6);
    position: relative;
    user-select: none;
    border: 1px solid rgba(15,23,42,0.08);
    background: linear-gradient(180deg, #ffffff 0%, #e9eef6 100%);
    /* ★ 对齐电商助手立体胶囊：双层投影（外大影 + 外小影 + 内高光） */
    box-shadow: 0 2px 5px rgba(15,23,42,0.12), 0 1px 2px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.95);
    width: 100%;
    text-align: left;
}
.tc-sidebar-item:active {
    /* ★ 对齐电商助手按下态：下沉 1px + 内凹 */
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(15,23,42,0.14), inset 0 1px 3px rgba(15,23,42,0.12);
}
.tc-sidebar-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #2563eb;
}
.tc-sidebar-item:hover {
    background: linear-gradient(180deg, #ffffff 0%, #dfe7f2 100%);
    transform: translateY(-1px);
    color: #0f172a;
    /* ★ 对齐电商助手悬停态三层阴影 */
    box-shadow: 0 4px 9px rgba(15,23,42,0.16), 0 1px 2px rgba(15,23,42,0.10), inset 0 1px 0 rgba(255,255,255,0.95);
}
.tc-sidebar-item.active {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: rgba(37,99,235,0.55);
    /* ★ 对齐电商助手选中态三层阴影（大蓝影 + 中蓝影 + 内高光） */
    box-shadow: 0 4px 10px rgba(37,99,235,0.45), 0 1px 3px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
.tc-sidebar-item.active:hover {
    /* ★ 对齐电商助手：选中态 hover 不下沉 */
    transform: none;
}
.tc-sidebar-item.active svg { color: #fff; }
.tc-sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #60a5fa;
    border-radius: 0 2px 2px 0;
}
.tc-sidebar-item .tc-sidebar-label { flex: 1; }

/* ── 两区域布局（桌面端 ≥901px）────────────────────────
   Zone 1（功能区）：左侧侧栏 + 右侧内容（首页 / 功能页）
   Zone 2（固定展示区）：共享办公 + 页脚，fixed 底部全宽
     · 贯穿到左侧最边缘（包括侧栏下方区域）
     · 所有页面（首页 / 功能页）均常驻显示，不随切换隐藏
     · 侧栏 bottom 由 JS 设到 office+footer 总高度，停在 Zone 2 上方
   ───────────────────────────────────────────────────── */
@media (min-width: 901px) {
    /* ★ 内容面板 = 固定视口 + 内部滚动（对齐电商助手）：
       内容在面板内滚动、到顶部边界被裁掉消失，绝不透过分类栏；
       top = 分类栏底(--panel-top, JS 按分类栏显隐动态设)，与分类栏白头连成一块完整圆角面板 */
    .main-content {
        position: fixed;
        top: var(--panel-top, 130px);
        left: 212px;
        right: 12px;
        bottom: 12px;
        margin: 0;
        overflow-y: auto;
        background: #ffffff;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 12px 32px rgba(15,23,42,0.14), 0 2px 8px rgba(15,23,42,0.10);  /* ★ 灰调悬浮投影（对齐电商助手） */
        box-sizing: border-box;
    }
    .tc-sidebar-toggle { display: none !important; }

    /* Zone 2：共享办公区 —— fixed 底部全宽贯穿（覆盖侧栏下方区域）。
       ★ 极致紧凑：高度约 140px，配合 footer≈150px 共≈290px，侧栏仍有充足空间。
       bottom 交给 JS(layoutBottomBar) 内联设 footerH（不加 !important，保证可被内联覆盖）。 */
    .office-section {
        position: fixed !important;
        left: 212px !important; /* ★ 与功能区白面板左缘对齐（原 200px） */
        right: 0 !important;
        bottom: 0;              /* JS 内联覆盖为 footerH */
        z-index: 1200 !important;
        margin: 0 !important;
        max-height: 230px;
        overflow: hidden;
        padding: 1.1rem 2rem !important;
        border-radius: 0 !important;
        box-sizing: border-box;
    }
    .office-section .container { padding: 0 !important; }
    .office-content {
        padding: .35rem 1rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 24px;
        flex-wrap: wrap;
    }
    .office-content h2 { font-size: 1.25rem; margin: 0 !important; }
    .office-content > p { font-size: .85rem; margin: 0 !important; opacity: .85; }
    .office-cards { gap: 18px !important; }
    .office-card { padding: .7rem 1.2rem !important; margin: 0 !important; }
    .office-card h3 { font-size: .95rem !important; margin: 0 !important; }
    .office-card i { font-size: 1.15rem !important; }
    .apply-btn { padding: .55rem 1.4rem !important; font-size: .9rem !important; margin: 0 !important; }

    /* Zone 2：页脚 —— fixed 最底部全宽；高度约 150px 紧凑三列 */
    /* 页脚：已由 JS 移入首页内容面板内部，随面板内容滚动（面板内全宽，无需让位侧栏） */
    .footer {
        position: static !important;
        margin: 0 !important;
        width: auto !important;
        padding: 1rem 2rem .75rem !important;
        border-radius: 0 !important;
        box-sizing: border-box;
    }
    /* 页脚只在首页显示：
       首页（html.show-catbar）页脚走文档流，出现在内容底部，随页面滚动；
       功能页 / 详情 / 文章 / 搜索等其余页面一律隐藏，侧栏延伸到底部。 */
    html.show-catbar .footer { display: block !important; }
    html:not(.show-catbar) .footer { display: none !important; }
    /* 首页内容分类固定栏：仅首页显示，进入功能页/二级页一律隐藏（CSS 兜底，防 JS 未同步残留） */
    html.tc-on-function #homeCatTopBar { display: none !important; }
    /* 功能页（图片创作/视频创作/AI助手等）：
       ① 不显示居中 backTopBar 标题栏（与 JS 同步隐藏，CSS 兜底）
       ② 不显示底部页脚；#function-page-container 占满到屏幕底部
       ③ 不显示功能页内层标题栏 func-page-header（标题+副标题行） */
    html.tc-on-function #backTopBar { display: none !important; }
    html.tc-on-function .func-page-header { display: none !important; }
    /* 兜底：只有 html.show-catbar（=首页）时才显示分类栏，其余任何页面强制隐藏 */
    html:not(.show-catbar) #homeCatTopBar { display: none !important; }
    .footer-grid {
        display: grid !important;
        grid-template-columns: 1.5fr 1fr 1fr !important;
        gap: 1rem 2rem !important;
        margin: 0 !important;
    }
    .footer-section { margin: 0 !important; }
    .footer-section h3 { font-size: .8rem !important; margin: 0 0 .4rem !important; }
    .footer-desc { font-size: .7rem !important; line-height: 1.4 !important; margin: .3rem 0 !important; }
    .footer-logo img { width: 32px !important; height: 32px !important; }
    .footer-logo-text .name { font-size: .85rem !important; }
    .footer-logo-text .subtitle { font-size: .7rem !important; }
    .footer-links { font-size: .75rem !important; }
    .footer-links li { margin: 0 !important; line-height: 1.5 !important; }
    .footer-links a { font-size: .75rem !important; }
    .footer-contact-item { font-size: .72rem !important; margin-bottom: .2rem !important; }
    .footer-contact-item i { font-size: .72rem !important; }
    .footer-social { display: none !important; }
    .footer-bottom { padding-top: .5rem !important; }
    .footer-bottom p { font-size: .65rem !important; margin: 0 !important; }

    /* Zone 1：功能页容器 —— 让位侧栏(left:200px) 和 固定展示区(bottom: JS 设) */
    #function-page-container {
        position: fixed;
        top: var(--app-top, 72px);  /* ★ 与侧栏同源：header 实测高 + 12 灰缝（JS 内联覆盖） */
        left: 212px;         /* ★ 与 .main-content 同起点：对齐悬浮白面板左缘 */
        right: 12px;         /* ★ 右边同样留悬浮间隙 */
        bottom: 0;           /* JS layoutBottomBar 覆盖为 12px */
        margin: 0;
        overflow-y: auto;
        z-index: 100;
        /* ★ 功能区 = 独立白色背景区（与首页 .main-content 同一套悬浮白面板外观） */
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
        box-sizing: border-box;
        display: none;
    }
}

/* ── 右侧功能页容器：fixed 覆盖「头部下方 → 底部固定条(footer/office)上方」的区域，
   点击侧栏按钮立即显示，不依赖 #mainContent 的显隐（避免被主页内容竞争顶出视口）── */
#function-page-container {
    position: fixed;
    top: var(--app-top, 72px);  /* ★ 与侧栏同源（--app-top = header 实测高 + 12 灰缝）；JS(layoutSidebarTop) 内联覆盖 */
    left: 212px;        /* ★ 与首页 .main-content 面板同起点（悬浮白面板左缘） */
    right: 12px;        /* ★ 右边同首页面板留 12px 灰缝 */
    bottom: 12px;       /* ★ 底部同首页面板留 12px 灰缝（JS layoutBottomBar 也覆盖为 12px） */
    margin: 0;
    overflow-y: auto;
    z-index: 100;
    background: #ffffff; /* ★ 白底 + 圆角 + 投影，与首页面板同一套悬浮外观 */
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    box-sizing: border-box;
    display: none;
}
@media (max-width: 900px) {
    #function-page-container { left: 0; }   /* 窄屏侧栏抽屉收起，功能页全宽 */
}
#function-page-container .container {
    padding-top: 24px;
    padding-bottom: 24px;
}

/* ── ★ 首页面板 flex 列布局：页脚恒驻内容面板底部（用户反馈 2026-10-15）──
   首页内容（分类卡 + 共享内容流）由 JS(renderHomePage) 渲染进 #mainContent，
   页脚由 injectSidebarDom 移入面板内部作为滚动流末尾。
   问题：内容少时页脚紧跟卡片下方，面板大片留白在其后 → 难看。
   解法：首页面板改 flex 列，内容区(.categories-section) flex:1 0 auto 撑满剩余高度，
   页脚自然落到面板底部；内容超一屏时 overflow-y:auto 照常滚动。
   仅限首页（html.show-catbar 且非管理态）生效，不影响功能页/二级页的块级布局。
   ⚠ 特异性说明：须高于 index.html 内联的
   `body:not(.admin-mode) .main-content:not(#function-page-container){display:block!important}`（白屏修复规则，特异性 1,2,1），
   故用 `html.show-catbar body:not(.admin-mode) #mainContent`（1,2,2）+ !important 覆盖；
   行内 JS 设的 display:block 非 !important，同样被本规则压制。 */
html.show-catbar body:not(.admin-mode) #mainContent {
    display: flex !important;
    flex-direction: column;
}
html.show-catbar #mainContent > .categories-section {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
html.show-catbar #mainContent > .categories-section > .container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.func-page-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px;
}
.func-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.func-page-header .fp-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}
.func-page-header .fp-sub {
    font-size: 13px;
    color: #94a3b8;
}
.func-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(15,23,42,0.05);
    margin-bottom: 18px;
}
.func-tabs {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    padding: 4px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-bottom: 14px;
    scrollbar-width: thin;
    flex-shrink: 0;
    min-height: 40px;
    align-items: center;
    box-sizing: border-box;
}
.func-tabs::-webkit-scrollbar { height: 4px; }
.func-tabs::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.func-tabs.func-tabs-wrap { flex-wrap: wrap; overflow-x: visible; }
/* 独立 .func-tab 基础样式（白底描边胶囊），保证按钮在任何上下文都可见 */
.func-tab {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #475569;
    white-space: nowrap;
    transition: all 0.15s;
}
/* .func-tabs 容器内按钮：白底+描边可见胶囊，保证 H5 侧栏下 4 个分类按钮一定显示（选中态为蓝色渐变，与电商助手 .gen-tab 一致） */
.func-tabs .func-tab {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: all 0.2s ease;
}
.func-tabs .func-tab:hover {
    color: #1e293b;
    background: #f8fafc;
    border-color: #cbd5e1;
}
.func-tabs .func-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.func-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    color: #1e293b;
}
.func-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.func-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.func-select {
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    color: #1e293b;
    min-width: 140px;
}
.func-label { font-size: 13px; color: #64748b; font-weight: 600; }
.func-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg,#3b82f6,#2563eb);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.func-btn:hover { filter: brightness(1.05); }
.func-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.func-result {
    margin-top: 16px;
    border-top: 1px solid #eef2f7;
    padding-top: 14px;
    font-size: 14px;
    color: #334155;
    line-height: 1.7;
}
.func-result img { max-width: 100%; border-radius: 10px; margin: 6px 0; }
.func-result video { max-width: 100%; border-radius: 10px; margin: 6px 0; background: #000; }
.func-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2563eb;
    font-size: 14px;
    padding: 8px 0;
}
.func-spinner::before {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: tcSpin 0.8s linear infinite;
}
@keyframes tcSpin { to { transform: rotate(360deg); } }
.func-err { color: #dc2626; font-size: 13px; }
.func-hint { color: #94a3b8; font-size: 12px; margin-top: 6px; }

/* ── AI助手 对话布局 ── */
/* ★ minmax(0,1fr)：右栏默认 min-width:auto，会被长代码块/长链接的 min-content 撑爆并冲出页面 */
.tc-chat-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; min-width: 0; }
.tc-chat-side {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 10px;
    max-height: 620px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tc-newchat-btn {
    width: 100%;
    box-sizing: border-box;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
}
.tc-newchat-btn:hover { background: #dbeafe; filter: none; }
.tc-chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.tc-chat-conv {
    height: 44px;
    flex: 0 0 44px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.tc-chat-conv.active { border-color: #3b82f6; background: rgba(59,130,246,0.08); }
.tc-chat-conv-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tc-chat-conv-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tc-chat-conv-count { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.tc-conv-del {
    flex-shrink: 0;
    width: 16px; height: 16px;
    border: none; border-radius: 50%;
    background: rgba(148,163,184,0.18);
    color: #64748b; font-size: 12px; line-height: 1;
    cursor: pointer; padding: 0;
}
.tc-conv-del:hover { background: #dc2626; color: #fff; }
.tc-chat-conv-time { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.tc-chat-main {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 620px;
    min-width: 0;          /* 允许被 grid 压缩，不让内容撑破外框 */
    overflow: hidden;      /* 圆角内裁切，杜绝子元素溢出到卡片外 */
}
.tc-chat-msgs {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;    /* 气泡内部自己滚动，消息区绝不横向溢出 */
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.tc-msg { display: flex; width: 100%; min-width: 0; }
.tc-msg-user { justify-content: flex-end; }
.tc-msg-ai { justify-content: flex-start; }
.tc-msg-ai-row { display: flex; align-items: flex-start; gap: 8px; width: 100%; min-width: 0; }
.tc-msg-avatar {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg,#3b82f6,#2563eb);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 700;
}
.tc-msg-bubble {
    max-width: 75%;
    min-width: 0;                 /* ★ 关键：不加则 flex 子项按内容最小宽度撑开，长代码块直接溢出 */
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow-x: hidden;           /* 超长单词/URL 也不外溢，必要时换行 */
    box-sizing: border-box;
}
.tc-msg-user .tc-msg-bubble { background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; }
.tc-msg-ai .tc-msg-bubble { background: #f1f5f9; color: #1e293b; }
.tc-msg-bubble code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; font-size: 13px; word-break: break-all; }
/* 代码块：宽度锁死在气泡内，超长单行在自己的框里横向滚动 */
.tc-msg-bubble pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    margin: 8px 0;
}
.tc-msg-bubble pre code { background: none; padding: 0; font-size: 12.5px; white-space: inherit; word-break: inherit; }
/* AI 思考中占位气泡 */
.tc-think-bubble { display: flex; align-items: center; gap: 8px; background: #f1f5f9; color: #64748b; }
.tc-think-label { font-size: 13px; color: #64748b; }
/* 等待秒表 + 取消（上游模型慢，必须让用户看到还在跑，并能主动放弃） */
.tc-think-sec { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.tc-think-cancel {
    margin-left: 4px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    padding: 1px 9px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.tc-think-cancel:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
/* 失败/超时后的重试 */
.tc-retry-btn {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.tc-retry-btn:hover { background: #dbeafe; }
/* AI 出图状态行（生成中 / 成功 / 失败） */
.tc-gen-state {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}
.tc-gen-ok { color: #15803d; }
.tc-gen-err { color: #b91c1c; white-space: pre-line; align-items: flex-start; }
.tc-gen-spin {
    width: 12px; height: 12px; flex-shrink: 0;
    border: 2px solid #cbd5e1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tcGenSpin 0.8s linear infinite;
}
@keyframes tcGenSpin { to { transform: rotate(360deg); } }
.tc-gen-cancel {
    margin-left: auto;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.2;
}
.tc-gen-cancel:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
/* AI 生成的图片（气泡内），比上传缩略图略大一些 */
.tc-msg-ai .tc-msg-imgs { margin-top: 8px; }
.tc-msg-ai .tc-msg-img { max-width: 260px; max-height: 260px; cursor: zoom-in; }
.tc-think-dots { display: inline-flex; gap: 3px; }
.tc-think-dots i {
    width: 6px; height: 6px; border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
    animation: tcThinkBounce 1.2s infinite ease-in-out;
}
.tc-think-dots i:nth-child(2) { animation-delay: 0.2s; }
.tc-think-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes tcThinkBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.tc-chat-input {
    padding: 12px 14px;
    border-top: 1px solid #eef2f7;
}
.tc-input-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.tc-chat-input .func-input { min-height: 56px; flex: 1; min-width: 0; width: 100%; box-sizing: border-box; }
/* 图片上传按钮 */
.tc-attach-btn {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    line-height: 0;
}
.tc-attach-btn svg { display: block; }
.tc-input-row .func-btn { height: 44px; padding: 0 18px; box-sizing: border-box; }
.tc-attach-btn:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.tc-attach-btn.active { border-color: #3b82f6; background: #dbeafe; color: #1d4ed8; }
/* 待发送图片预览条 */
.tc-attach-strip { display: none; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tc-attach-item {
    position: relative;
    width: 56px; height: 56px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}
.tc-attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-attach-del {
    position: absolute; top: 1px; right: 1px;
    width: 16px; height: 16px;
    border: none; border-radius: 50%;
    background: rgba(15,23,42,0.66);
    color: #fff; font-size: 11px; line-height: 1;
    cursor: pointer; padding: 0;
}
.tc-attach-del:hover { background: #dc2626; }
/* 对话中的图片 */
.tc-msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-msg-bubble.has-img { padding: 8px 10px; }
.tc-msg-text { margin-top: 6px; }
.tc-msg-img {
    max-width: 180px; max-height: 180px;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
    background: #fff;
}
/* 图片大图预览 */
.tc-img-viewer {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(15,23,42,0.86);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}
.tc-img-viewer img { max-width: 92vw; max-height: 88vh; border-radius: 10px; background: #fff; }

/* ── 电商自动化 多步骤卡片 ── */
.ecom-step {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}
.ecom-step .step-no {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg,#3b82f6,#2563eb);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.ecom-step .step-body { flex: 1; }
.ecom-step .step-title { font-weight: 600; color: #1e293b; margin-bottom: 6px; font-size: 14px; }

/* ── 素材检测 图片上传预览 ── */
.tc-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}
.tc-upload-zone:hover { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.04); }
.tc-upload-preview { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.tc-upload-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }

/* ── 响应式：窄屏收起侧栏为抽屉 ── */
@media (max-width: 900px) {
    .tc-sidebar {
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 200px;
        z-index: 1100;
    }
    html.tc-sidebar-open .tc-sidebar { transform: translateX(0); }
    html.tc-sidebar-open .main-content { margin-left: 0; }
    .tc-sidebar-toggle { display: inline-flex !important; }
    .tc-chat-layout { grid-template-columns: 1fr; }
}
.tc-sidebar-toggle {
    display: none;
    position: fixed;
    left: 12px;
    top: 70px;
    z-index: 1101;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg,#3b82f6,#2563eb);
    color: #fff;
    align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}


/* ── ★ 功能页高度对齐电商助手：撑满容器，消除下方灰色留白 ── */
#function-page-container { box-sizing: border-box; }
#function-page-container .func-page-wrap {
    /* 保留居中最大宽度，对齐电商助手「全宽主体 + 居中卡片(max-width) + 铺满高度」 */
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 16px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* AI助手：对话双栏铺满剩余高度（对应电商助手 ai-tools-body 的 flex:1;min-height:0） */
#function-page-container .tc-chat-layout {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    gap: 14px;
}
#function-page-container .tc-chat-side,
#function-page-container .tc-chat-main {
    max-height: none;            /* 去掉 620px 限制，跟随容器高度 */
    min-height: 0;
}
#function-page-container .tc-chat-msgs { min-height: 0; }
/* 图片/视频/素材/自动化等其他功能页：内容卡片同样撑开高度、内部滚动 */
#function-page-container .func-page-wrap > .func-card {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
}

/* 窄屏：单栏模式下也要撑满 */
@media (max-width: 768px) {
    #function-page-container .tc-chat-layout { grid-template-columns: 1fr; }
    #function-page-container .func-page-wrap { max-width: none; }
}

/* ============================================================
 * ★ 结构对齐电商助手：双栏（图片/视频/电商自动化）+ 素材检测分区 + 电商 Agent
 * ============================================================ */

/* 双栏布局：左侧结果主区 + 右侧参数/侧栏（对齐电商助手 page-layout） */
#function-page-container .tc-page-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: 1fr;
    gap: 14px;
    align-items: stretch;
}
#function-page-container .tc-page-layout.ecom-layout {
    grid-template-columns: minmax(0, 1fr) 348px;
}
#function-page-container .tc-page-layout > .tc-main-panel,
#function-page-container .tc-page-layout > .tc-side-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#function-page-container .tc-page-layout > .tc-main-panel > .func-card,
#function-page-container .tc-page-layout > .tc-side-panel > .func-card {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
}
#function-page-container .tc-page-layout > .tc-side-panel > .func-card.side-tight {
    flex: 0 0 auto;
    overflow: hidden;
}

/* 卡片标题 + 空状态 */
.tc-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tc-empty-state {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.8;
    text-align: center;
    padding: 48px 12px;
}

/* 电商自动化 Agent：快捷指令 + 消息流 */
.tc-ecom-msgs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tc-ecom-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tc-ecom-chip {
    font-size: 12px;
    padding: 4px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}
.tc-ecom-chip:hover { border-color: #3b82f6; color: #2563eb; }
.tc-ecom-msg {
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    max-width: 88%;
    flex-shrink: 0;
}
.tc-ecom-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}
.tc-ecom-msg.agent {
    align-self: flex-start;
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #eef2f7;
    border-radius: 14px 14px 14px 4px;
}
.tc-ecom-msg.agent .ecom-out { font-size: 13px; color: #334155; margin-top: 8px; }

/* 素材检测：居中单栏 + 结果分区（对齐电商助手 material-check-page） */
#function-page-container .tc-mat-page {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#function-page-container .tc-mat-page > .func-card { flex: 0 0 auto; }
.tc-mat-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tc-mat-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}
.tc-mat-tab.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-color: transparent;
}
.tc-mat-files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.tc-mat-file { position: relative; width: 72px; }
.tc-mat-file img, .tc-mat-file video {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
}
.tc-mat-file .rm {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}
/* 检测中动画 */
.tc-mat-detecting { text-align: center; padding: 16px 0; }
.tc-mat-scanner {
    width: 80px;
    height: 80px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid #dbeafe;
    border-top-color: #3b82f6;
    animation: tcSpin 1s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.tc-mat-progress {
    height: 8px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
    margin: 14px auto 8px;
    max-width: 320px;
}
.tc-mat-progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.3s;
}
/* 检测结果分区 */
.tc-mat-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.tc-mat-risk { font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 999px; }
.tc-mat-risk.low { background: #d1fae5; color: #047857; }
.tc-mat-risk.medium { background: #fef3c7; color: #b45309; }
.tc-mat-risk.high { background: #fecaca; color: #b91c1c; }
.tc-mat-section { margin-bottom: 16px; }
.tc-mat-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tc-mat-viol {
    display: flex;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.tc-mat-viol.high { border-left: 3px solid #dc2626; }
.tc-mat-viol.medium { border-left: 3px solid #f59e0b; }
.tc-mat-viol.low { border-left: 3px solid #94a3b8; }
.tc-mat-ads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tc-mat-ad {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafbfc;
}

/* ════════════════════════════════════════════════════════════════ */
/*  电商助手 1:1 卡片 / 参数 / 表单 / 上传 / 结果 设计系统          */
/*  供 图片创作 / 视频创作 / 素材检测 / 电商自动化 功能页复用       */
/* ════════════════════════════════════════════════════════════════ */

/* 双栏布局：左 结果区 + 右 参数卡 */
.dp-page-layout { flex:1; min-height:0; display:grid; grid-template-columns: minmax(0,1fr) 380px; gap:14px; align-items:stretch; }
.dp-main-panel, .dp-side-panel { display:flex; flex-direction:column; min-height:0; gap:14px; }
.dp-main-panel > .dp-card { flex:1; min-height:0; }
.dp-side-panel > .dp-card { flex:1; min-height:0; display:flex; flex-direction:column; overflow:hidden; }

/* 卡片 */
.dp-card { background:#fff; border:1px solid #eef2f7; border-radius:14px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.dp-card-header { padding:12px 16px; border-bottom:1px solid #eef2f7; display:flex; align-items:center; gap:8px; flex-shrink:0; }
.dp-card-title { font-size:15px; font-weight:700; color:#0f172a; margin:0; display:flex; align-items:center; gap:6px; }
.dp-card-title .dp-hint { font-size:11px; font-weight:400; color:#94a3b8; margin-left:auto; }
.dp-card-body { padding:14px 16px; flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:12px; }

/* 空状态 */
.dp-empty { flex:1; min-height:120px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; color:#94a3b8; text-align:center; padding:40px 16px; }
.dp-empty svg { opacity:.3; margin-bottom:8px; }
.dp-empty p.dp-empty-main { font-size:14px; color:#475569; margin:0; }
.dp-empty p.dp-empty-hint { font-size:12px; color:#94a3b8; line-height:1.6; margin:0; }

/* 表单基础 */
.dp-form-label { display:block; font-size:12px; font-weight:600; color:#475569; margin-bottom:5px; }
.dp-form-label .dp-req { color:#ef4444; margin-left:2px; }
/* ★ 2026-10-24 fix7：AI 识别按钮（放在 label 行内右侧） */
.dp-btn-ai { display:inline-flex; align-items:center; margin-left:8px; padding:3px 10px; height:auto; font-size:11px; font-weight:600; color:#7c3aed; background:#f5f3ff; border:1px solid #ddd6fe; border-radius:999px; cursor:pointer; vertical-align:middle; transition:background .15s,border-color .15s; }
.dp-btn-ai:hover:not(:disabled) { background:#ede9fe; border-color:#c4b5fd; }
.dp-btn-ai:disabled { opacity:.6; cursor:not-allowed; }
/* AI 识别结果面板 */
.dp-brief-out { margin-top:8px; padding:12px 14px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; }
.dp-brief-head { font-size:12px; font-weight:700; color:#334155; margin-bottom:6px; }
.dp-brief-points { margin:0 0 6px; padding-left:18px; }
.dp-brief-points li { font-size:12px; color:#475569; line-height:1.7; }
.dp-brief-tip { font-size:11px; color:#94a3b8; }
.dp-form-input, .dp-form-select, .dp-form-textarea { width:100%; box-sizing:border-box; padding:8px 10px; border:1.5px solid #e2e8f0; border-radius:8px; font-size:13px; font-family:inherit; color:#0f172a; background:#fff; outline:none; transition:border-color .15s, box-shadow .15s; }
.dp-form-input:focus, .dp-form-select:focus, .dp-form-textarea:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.dp-form-textarea { resize:vertical; min-height:80px; line-height:1.55; }
.dp-form-select { appearance:none; cursor:pointer; background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23cbd5e1%27 stroke-width=%272%27%3E%3Cpolyline points=%276 9 12 15 18 9%27/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; padding-right:28px; }
.dp-form-select option, .dp-form-select option:checked { background:#f8fafc; color:#0f172a; }
.dp-form-hint { font-size:11px; color:#94a3b8; line-height:1.5; margin-top:4px; }

/* 并排双框 */
.dp-duo { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* 参数分组 */
.dp-param-group { background:#f8fafc; border:1px solid #eef2f7; border-radius:10px; padding:12px; }
.dp-param-group-head { display:flex; align-items:center; gap:6px; margin-bottom:10px; font-size:12px; font-weight:600; color:#475569; }
.dp-param-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.dp-param-card { background:#fff; border:1px solid #eef2f7; border-radius:10px; padding:10px 12px; min-width:0; }
.dp-param-card label { display:block; font-size:11px; font-weight:600; color:#64748b; margin-bottom:6px; }
.dp-param-card input[type="range"] { width:100%; margin-top:4px; accent-color:#3b82f6; }
.dp-badge { background:#3b82f6; color:#fff; font-size:10px; padding:1px 6px; border-radius:8px; margin-left:4px; font-weight:600; display:inline-block; }

/* 上传区 */
.dp-upload-zone { border:2px dashed #cbd5e1; border-radius:10px; padding:14px; text-align:center; color:#94a3b8; cursor:pointer; font-size:13px; background:#f8fafc; transition:all .15s; line-height:1.5; }
.dp-upload-zone:hover { border-color:#3b82f6; background:rgba(59,130,246,.04); color:#3b82f6; }
.dp-upload-zone.dp-required { border-color:#3b82f6; }
.dp-upload-zone.dp-multiple { border-color:#10b981; }
.dp-upload-tag { display:inline-block; font-size:11px; font-weight:600; padding:1px 8px; border-radius:8px; margin-left:6px; }
.dp-upload-tag.req { background:#3b82f6; color:#fff; }
.dp-upload-tag.opt { background:#e2e8f0; color:#475569; }
.dp-upload-preview { margin-top:10px; display:flex; gap:10px; flex-wrap:wrap; }
.dp-upload-preview .dp-preview-item { position:relative; width:72px; height:72px; border-radius:8px; overflow:hidden; border:1px solid #e2e8f0; background:#fff; flex:0 0 72px; }
.dp-upload-preview .dp-preview-item img, .dp-upload-preview .dp-preview-item video { width:100%; height:100%; object-fit:cover; display:block; }
.dp-upload-preview .dp-preview-del { position:absolute; top:2px; right:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(15,23,42,.72); color:#fff; font-size:14px; line-height:18px; padding:0; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .15s; }
.dp-upload-preview .dp-preview-del:hover { background:#ef4444; transform:scale(1.08); }
.dp-up-file { position:relative; width:72px; height:72px; }
.dp-up-file img, .dp-up-file video { width:100%; height:100%; object-fit:cover; border-radius:8px; border:1px solid #e2e8f0; display:block; }
.dp-up-file .dp-up-rm { position:absolute; top:-6px; right:-6px; width:20px; height:20px; border-radius:50%; background:#ef4444; color:#fff; border:none; font-size:12px; line-height:18px; cursor:pointer; box-shadow:0 1px 4px rgba(0,0,0,.2); }

/* 槽位（复刻/数字人） */
.dp-slot { background:#f8fafc; border:1px solid #eef2f7; border-radius:10px; padding:10px 12px; }
.dp-slot-head { display:flex; align-items:center; gap:6px; font-size:12px; font-weight:600; color:#0f172a; margin-bottom:8px; }
.dp-slot-tag { margin-left:auto; font-size:11px; font-weight:400; color:#94a3b8; }

/* 按钮 */
.dp-btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:42px; padding:0 18px; border-radius:10px; font-size:14px; font-weight:600; cursor:pointer; border:1px solid transparent; transition:filter .15s, transform .05s; font-family:inherit; }
.dp-btn:active { transform:translateY(1px); }
.dp-btn-primary { background:linear-gradient(135deg,#2563eb,#3b82f6); color:#fff; box-shadow:0 4px 14px rgba(59,130,246,.15); }
.dp-btn-primary:hover { filter:brightness(1.05); }
.dp-btn-primary:disabled { opacity:.6; cursor:not-allowed; }
.dp-btn-secondary { background:#fff; border-color:#e2e8f0; color:#475569; }
.dp-btn-secondary:hover { border-color:#cbd5e1; }
.dp-btn-ghost { background:transparent; color:#475569; height:42px; font-size:14px; padding:0 18px; font-weight:600; border:1px solid #e2e8f0; }
.dp-gen-actions { display:flex; gap:10px; }
.dp-gen-actions .dp-btn-primary,
.dp-gen-actions .dp-btn-ghost { flex:1 1 0; min-width:0; }

/* 结果网格 */
.dp-result-imgs { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; }
.dp-result-imgs img { width:100%; border-radius:10px; border:1px solid #eef2f7; display:block; cursor:zoom-in; transition:box-shadow .15s; }
.dp-result-imgs img:hover { box-shadow:0 4px 16px rgba(37,99,235,.22); }
/* 生成结果：每张图一个单元格（图 + 下载按钮）。2026-10-24 */
.dp-out-cell { display:flex; flex-direction:column; gap:6px; }
.dp-out-cell .dp-out-dl { width:100%; text-align:center; box-sizing:border-box; }
/* 每张图对应的版式名（P1 首屏海报 / M1 白底标准 …）2026-10-24 */
.dp-out-layout { font-size:11px; font-weight:600; color:#2563eb; background:#eff6ff; border:1px solid #dbeafe; border-radius:6px; padding:3px 8px; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dp-result-video { width:100%; max-height:480px; border-radius:10px; background:#000; display:block; }

/* 生成中 / 忙态 */
.dp-busy { flex:1; min-height:120px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:40px; color:#475569; font-size:14px; text-align:center; }
.dp-busy .dp-spin { width:30px; height:30px; border:3px solid rgba(59,130,246,.2); border-top-color:#3b82f6; border-radius:50%; animation:dpspin .7s linear infinite; }
.dp-busy .dp-spin-msg { font-size:13px; color:#64748b; }
@keyframes dpspin { to { transform:rotate(360deg); } }

/* 结果内提示 */
.dp-result-err { color:#dc2626; font-size:13px; padding:10px; background:#fef2f2; border-radius:8px; }
.dp-result-ok { display:inline-block; align-self:flex-start; max-width:100%; color:#047857; font-size:13px; padding:6px 14px; background:#d1fae5; border-radius:8px; }

/* 图片预览灯箱（点击生成结果放大）：中性透明黑遮罩（全局弹窗统一 0.5），滚轮缩放+拖拽平移 */
.dp-lightbox { position:fixed; left:0; top:0; right:0; bottom:0; z-index:4000; display:none; align-items:center; justify-content:center; touch-action:none; }
.dp-lightbox.open { display:flex; }
.dp-lightbox-mask { position:absolute; left:0; top:0; right:0; bottom:0; background:rgba(0,0,0,.5); }
.dp-lightbox-img { position:relative; z-index:1; max-width:92vw; max-height:88vh; border-radius:10px; box-shadow:0 12px 40px rgba(0,0,0,.4); transform-origin:center center; will-change:transform; user-select:none; -webkit-user-drag:none; cursor:grab; transition:transform .12s ease-out; }
.dp-lightbox-img.dragging { transition:none; cursor:grabbing; }
.dp-lightbox-close { position:absolute; top:14px; right:16px; z-index:3; width:40px; height:40px; border:none; border-radius:50%; background:rgba(0,0,0,.55); color:#fff; font-size:24px; line-height:38px; padding:0; cursor:pointer; }
.dp-lightbox-close:hover { background:rgba(0,0,0,.85); }
.dp-lightbox-zoombar { position:absolute; left:50%; transform:translateX(-50%); bottom:22px; z-index:3; display:flex; align-items:center; gap:4px; background:rgba(0,0,0,.55); border-radius:20px; padding:6px 10px; }
.dp-lightbox-zoombar button { min-width:30px; height:30px; border:none; border-radius:15px; background:transparent; color:#fff; font-size:17px; cursor:pointer; line-height:28px; padding:0 8px; }
.dp-lightbox-zoombar button:hover { background:rgba(255,255,255,.18); }
.dp-lightbox-zoombar .dp-zoom-val { color:#fff; font-size:12px; min-width:44px; text-align:center; }
.dp-lightbox-hint { position:absolute; top:18px; left:18px; z-index:3; color:rgba(255,255,255,.78); font-size:12px; background:rgba(0,0,0,.45); padding:6px 12px; border-radius:14px; }

/* 响应式 */
@media (max-width: 900px) {
  .dp-page-layout { grid-template-columns:1fr; }
}

@media (max-width: 768px) {
    #function-page-container .tc-page-layout,
    #function-page-container .tc-page-layout.ecom-layout { grid-template-columns: 1fr; }
    .tc-mat-ads { grid-template-columns: 1fr; }
    #function-page-container .tc-mat-page { max-width: none; }
}


/* ── 图片/视频创作 子功能面板（1:1 对齐电商助手）── */
.dp-field { display:flex; flex-direction:column; gap:6px; }
.dp-duo > .dp-field { gap:6px; }
.dp-tab-panel { display:none; flex-direction:column; gap:12px; }
.dp-tab-panel.on { display:flex; }
.dp-tpl-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px 14px; }
.dp-tpl-check { display:flex; align-items:center; gap:6px; font-size:12px; color:#475569; margin:0; cursor:pointer; }
.dp-tpl-check input { accent-color:#3b82f6; flex-shrink:0; }
.dp-param-group .dp-form-select, .dp-param-group .dp-form-input { min-height:38px; }

/* ── 素材检测 1:1 对齐电商助手（单列 dp-mat-*）── */
.dp-mat-page { flex:1; min-height:0; width:100%; max-width:880px; margin:0 auto; display:flex; flex-direction:column; gap:14px; overflow-y:auto; }
.dp-mat-page > .dp-card { flex-shrink:0; }
.dp-mat-zone.dp-drag { border-color:#3b82f6; background:rgba(59,130,246,.04); }
.dp-mat-zone { padding:26px; font-size:14px; }
.dp-mat-files { margin-top:8px; }
.dp-mat-progress { height:8px; background:#e2e8f0; border-radius:4px; overflow:hidden; width:100%; max-width:420px; margin:8px auto 0; }
.dp-mat-progress i { display:block; height:100%; width:0; background:linear-gradient(90deg,#3b82f6,#2563eb); transition:width .4s; }
.dp-mat-steps { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:14px; }
.dp-mat-step { font-size:12px; color:#94a3b8; background:#f1f5f9; padding:5px 12px; border-radius:999px; }
.dp-mat-step.done { color:#2563eb; background:rgba(59,130,246,.12); font-weight:600; }
.dp-mat-risk { font-size:12px; font-weight:700; padding:4px 12px; border-radius:999px; }
.dp-mat-risk.low { background:#d1fae5; color:#047857; }
.dp-mat-risk.medium { background:#fef3c7; color:#b45309; }
.dp-mat-risk.high { background:#fecaca; color:#b91c1c; }
.dp-mat-section { margin-bottom:14px; }
.dp-mat-section h4 { font-size:13px; font-weight:700; color:#0f172a; margin:0 0 8px; }
.dp-mat-viol { display:flex; align-items:center; gap:8px; padding:8px 10px; background:#f8fafc; border-radius:8px; margin-bottom:6px; border-left:3px solid #cbd5e1; }
.dp-mat-viol.high { border-left-color:#dc2626; background:#fef2f2; }
.dp-mat-viol.medium { border-left-color:#f59e0b; background:#fffbeb; }
.dp-mat-viol.low { border-left-color:#94a3b8; }
.dp-mat-optnum { width:26px; height:26px; line-height:26px; text-align:center; background:linear-gradient(135deg,#3b82f6,#2563eb); color:#fff; border-radius:50%; font-size:12px; font-weight:700; flex-shrink:0; }
.dp-mat-ads { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.dp-mat-ad { background:#f8fafc; border:1px solid #eef2f7; border-radius:8px; padding:10px; }
@media (max-width: 640px) { .dp-mat-ads { grid-template-columns:1fr; } .dp-mat-page { max-width:none; } }

/* ── 视频创作子面板 1:1 对齐电商助手 ── */
.dp-src-toggle { display:flex; gap:6px; background:#f1f5f9; border:1px solid #e2e8f0; border-radius:8px; padding:4px; }
.dp-src-toggle button { flex:1; border:none; background:transparent; padding:8px; border-radius:6px; font-size:13px; font-weight:600; color:#475569; cursor:pointer; font-family:inherit; }
.dp-src-toggle button.on { background:#fff; color:#2563eb; box-shadow:0 1px 3px rgba(0,0,0,.08); }
.dp-param-grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.dp-param-grid.span2 > .dp-param-card { grid-column:1/-1; }
.dp-busy-video .dp-spin { width:38px; height:38px; border-width:4px; }
.dp-result-video-wrap { margin-top:4px; }
.dp-result-video-wrap video { width:100%; border-radius:10px; background:#000; max-height:520px; display:block; }
.dp-dl-row { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }

/* ★「个人中心 → 我的AI密钥」：用户中心内为单列布局（无右侧面板） */
#userContent-myaikeys .dp-page-layout { grid-template-columns: minmax(0,1fr); }
#userContent-myaikeys .dp-main-panel > .dp-card { min-height:0; }
#userContent-myaikeys .dp-card-body { overflow:visible; }

/* ★ 修复（2026-10-22）：功能页模式下底层 #mainContent 保持 display:block 不隐藏，
   其顶部直角(0 0 16px 16px)会顶穿 #function-page-container 的顶部圆角，
   导致功能页"顶部没圆角"。功能页态下把 mainContent 圆角改为全 16px，
   两层圆角缺口对齐，不再露出直角。 */
html.tc-on-function #mainContent { border-radius: 16px !important; }

/* ★ 视频创作：分镜表 + 镜头列表（2026-10-22 重做） */
.dp-shot-table { display: flex; flex-direction: column; gap: 10px; }
.dp-shot-table-head { font-weight: 600; font-size: 13px; color: #1e293b; }
.dp-shot-row { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; gap: 6px 8px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; background: #fafbfc; }
.dp-shot-idx { font-size: 12px; color: #64748b; font-weight: 700; padding-top: 8px; }
.dp-shot-visual { grid-column: 2; width: 100%; min-height: 48px; resize: vertical; font-size: 13px; padding: 8px; border: 1px solid #d7dbe0; border-radius: 8px; box-sizing: border-box; }
.dp-shot-narr { grid-column: 2; width: 100%; font-size: 12px; padding: 7px 9px; border: 1px solid #d7dbe0; border-radius: 8px; box-sizing: border-box; }
.dp-clip-list { display: flex; flex-direction: column; gap: 10px; }
.dp-clip-item { display: flex; gap: 12px; align-items: center; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; }
.dp-clip-item video { width: 200px; max-width: 40%; border-radius: 8px; background: #000; }
.dp-clip-item b { min-width: 44px; color: #64748b; font-size: 12px; }
.dp-clip-dl { color: #2563eb; font-size: 13px; text-decoration: none; }

/* ★ 视频创作 AI 模型选择器（2026-10-22） */
.dp-model-field { margin-bottom: 12px; }
.dp-model-hint { font-size: 12px; color: #64748b; margin-top: 5px; line-height: 1.5; }
#vgen-model { width: 100%; }

/* ★ 视频创作：面板内分镜脚本（AI 生成 + 手动增删改，2026-10-22） */
.dp-shot-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.dp-shot-toolbar .dp-btn { flex: 1; white-space: nowrap; }
.dp-shot-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding-right: 2px; }
.dp-shot-row { display: grid; grid-template-columns: 24px minmax(0,1fr) 24px; gap: 8px; align-items: start;
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 10px; background: #fafbfc; }
.dp-shot-idx { font-size: 12px; font-weight: 700; color: #64748b; padding-top: 8px; text-align: center; }
.dp-shot-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dp-shot-body .dp-shot-visual { width: 100%; min-height: 44px; resize: vertical; }
.dp-shot-body .dp-shot-narr { width: 100%; }
.dp-shot-del { width: 24px; height: 24px; margin-top: 6px; border: 1px solid #e5e7eb; background: #fff;
  border-radius: 6px; color: #94a3b8; cursor: pointer; font-size: 15px; line-height: 1; }
.dp-shot-del:hover { color: #ef4444; border-color: #ef4444; background: #fef2f2; }
.dp-shot-empty { font-size: 13px; color: #94a3b8; text-align: center; line-height: 1.7;
  border: 1px dashed #cbd5e1; border-radius: 10px; padding: 18px 12px; }
.dp-shot-busy { font-size: 13px; color: #3b82f6; padding: 14px; text-align: center; }
.dp-shot-confirm { margin-top: 8px; }
.dp-shot-confirm .dp-btn { width: 100%; }

/* ★ 图片创作页（2026-10-24）：单列参数布局 + 大提示词框 + 多任务工作流动画 */
.img-gen-page .dp-duo { grid-template-columns:1fr; }
.img-gen-page .dp-param-grid { grid-template-columns:1fr; }
.img-gen-page .dp-param-grid.three { grid-template-columns:1fr; }
.img-gen-page .dp-form-textarea { min-height:130px; }
.dp-task { border:1px solid #eef2f7; border-radius:12px; padding:12px 14px; background:#fff; }
.dp-task + .dp-task { margin-top:10px; }
.dp-task-head { display:flex; align-items:center; gap:8px; }
.dp-task-tag { background:#eff6ff; color:#2563eb; font-size:11px; font-weight:600; padding:2px 8px; border-radius:6px; flex:0 0 auto; }
.dp-task-time { font-size:11px; color:#94a3b8; }
.dp-task-close { margin-left:auto; width:22px; height:22px; border:none; border-radius:6px; background:transparent; color:#94a3b8; font-size:16px; cursor:pointer; line-height:20px; padding:0; flex:0 0 auto; }
.dp-task-close:hover { background:#f1f5f9; color:#475569; }
.dp-task-flow { display:flex; align-items:center; gap:6px; margin:10px 0; }
.dp-step { display:flex; align-items:center; gap:5px; font-size:11px; color:#94a3b8; white-space:nowrap; }
.dp-step-dot { width:18px; height:18px; border-radius:50%; border:2px solid #e2e8f0; display:inline-flex; align-items:center; justify-content:center; font-size:10px; color:#fff; background:#fff; box-sizing:border-box; flex:0 0 18px; }
.dp-step.done { color:#16a34a; }
.dp-step.done .dp-step-dot { background:#16a34a; border-color:#16a34a; }
.dp-step.active { color:#2563eb; font-weight:600; }
.dp-step.active .dp-step-dot { border-color:#3b82f6; border-top-color:transparent; animation:dpspin .8s linear infinite; }
.dp-step-line { flex:1; height:2px; min-width:8px; background:#e2e8f0; border-radius:1px; overflow:hidden; position:relative; }
.dp-step-line::after { content:''; position:absolute; top:0; bottom:0; left:-40%; width:40%; background:linear-gradient(90deg, rgba(59,130,246,0), rgba(59,130,246,.55), rgba(59,130,246,0)); animation:dpflowline 1.6s linear infinite; }
@keyframes dpflowline { 0% { left:-40%; } 100% { left:100%; } }
.dp-task-body { display:flex; align-items:flex-start; gap:10px; min-height:34px; }
.dp-task-body .dp-spin { width:20px; height:20px; border:3px solid rgba(59,130,246,.2); border-top-color:#3b82f6; border-radius:50%; animation:dpspin .7s linear infinite; flex:0 0 20px; margin-top:2px; }
.dp-task-msg { font-size:12px; color:#64748b; padding-top:3px; }
.dp-task.err { border-color:#fecaca; background:#fffafa; }
.dp-task.err .dp-task-body .dp-result-err { flex:1; }
.dp-task.ok { border-color:#d1fae5; }
.dp-task-out { width:100%; }
/* ★ fix14：任务结束后收起工作流四步条 + 冻结连接线流动动画（否则看起来一直在生成） */
.dp-task.ok .dp-task-flow, .dp-task.err .dp-task-flow { display:none !important; }
.dp-task.err .dp-step-line::after { animation:none; }
.dp-result-ok { font-weight:600; }
.dp-result-err-float { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dp-err-close { border:none; background:transparent; color:#dc2626; font-size:16px; cursor:pointer; line-height:1; padding:0 2px; }

/* ★ 个人中心 · 创作历史（2026-10-24） */
.aihist-item { display:flex; gap:14px; padding:14px; border:1px solid #eef2f7; border-radius:12px; background:#fff; align-items:flex-start; }
.aihist-item + .aihist-item { margin-top:10px; }
.aihist-item .dp-result-imgs { width:180px; flex:0 0 180px; margin:0; }
.aihist-media { width:220px; max-height:160px; border-radius:10px; background:#000; display:block; flex:0 0 220px; }
.aihist-meta { flex:1; min-width:0; }
.aihist-prompt { font-size:13px; color:#0f172a; font-weight:600; line-height:1.5; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.aihist-sub { display:flex; gap:12px; font-size:11px; color:#94a3b8; margin-top:6px; flex-wrap:wrap; }
.aihist-ops { margin-top:10px; display:flex; gap:8px; }
.aihist-btn { padding:4px 12px; border-radius:8px; border:1px solid #e2e8f0; background:#fff; color:#475569; font-size:12px; cursor:pointer; text-decoration:none; display:inline-block; }
.aihist-btn:hover { border-color:#3b82f6; color:#2563eb; }
.aihist-btn.del:hover { border-color:#ef4444; color:#ef4444; }
.aihist-imgwrap img { cursor:zoom-in; }

/* ★ 功能区侧栏（2026-10-24）：功能分类吸顶 + 生成/清空按钮吸底（面板内滚动时保持可见） */
/* ★ 吸顶/吸底（修正版）：dp-card-body 有 14px/16px 内边距，sticky 约束矩形内缩于此，
   必须 top/bottom 负偏移 + 负外边距 + 等量内边距补回，才能完全盖住滚过的内容不留缝 */
.dp-side-panel .func-tabs { position:sticky; top:-14px; z-index:5; background:#fff; margin:-14px -16px 0; padding:14px 16px 10px; box-shadow:0 8px 10px -8px rgba(15,23,42,.16); }
.dp-tab-panel .dp-gen-actions { position:sticky; bottom:-14px; z-index:5; background:#fff; margin:0 -16px -14px; padding:10px 16px 14px; box-shadow:0 -8px 10px -8px rgba(15,23,42,.16); }

/* ★ 创作历史网格版（2026-10-24）：5 列 × 10 行/页，10 页一组，上一页/下一页 */
.aihist-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.aihist-card { border:1px solid #eef2f7; border-radius:12px; background:#fff; overflow:hidden; display:flex; flex-direction:column; }
.aihist-card:hover { border-color:#dbe4ff; box-shadow:0 4px 14px rgba(59,130,246,.12); }
.aihist-card-media { width:100%; height:150px; object-fit:cover; display:block; background:#000; }
.aihist-card-media.empty { display:flex; align-items:center; justify-content:center; color:#cbd5e1; font-size:12px; background:#f1f5f9; }
.aihist-card .aihist-imgwrap { display:block; height:150px; }
.aihist-card .aihist-imgwrap img { width:100%; height:150px; object-fit:cover; cursor:zoom-in; }
/* ★ 2026-10-24 fix7：图片组卡片（组内翻页 + 计数 + 版式标签） */
.aihist-media { position:relative; }
.aihist-media .aihist-imgwrap { position:relative; }
.aihist-gnav { position:absolute; top:50%; transform:translateY(-50%); width:26px; height:26px; border-radius:50%; border:none; background:rgba(15,23,42,.55); color:#fff; font-size:17px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .15s; z-index:2; }
.aihist-gnav:hover { background:rgba(37,99,235,.85); }
.aihist-gnav.prev { left:6px; }
.aihist-gnav.next { right:6px; }
.aihist-gcount { position:absolute; right:6px; bottom:6px; background:rgba(15,23,42,.6); color:#fff; font-size:11px; padding:2px 7px; border-radius:999px; z-index:2; }
.aihist-glayout { position:absolute; left:6px; top:6px; background:rgba(37,99,235,.88); color:#fff; font-size:11px; font-weight:600; padding:2px 8px; border-radius:6px; max-width:70%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; z-index:2; }
.aihist-card-body { padding:10px 12px 12px; display:flex; flex-direction:column; flex:1; min-width:0; }
.aihist-card .aihist-prompt { font-size:12px; font-weight:600; color:#0f172a; line-height:1.5; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.aihist-card .aihist-sub { display:flex; gap:8px; font-size:11px; color:#94a3b8; margin-top:6px; flex-wrap:wrap; }
.aihist-card .aihist-ops { margin-top:auto; padding-top:10px; display:flex; gap:6px; }
.aihist-pager { display:flex; align-items:center; justify-content:center; gap:6px; margin-top:18px; flex-wrap:wrap; }
.aihist-page { min-width:32px; height:32px; padding:0 10px; border:1px solid #e2e8f0; border-radius:8px; background:#fff; color:#475569; font-size:12px; cursor:pointer; }
.aihist-page:hover:not(:disabled) { border-color:#3b82f6; color:#2563eb; }
.aihist-page.on { background:#3b82f6; border-color:#3b82f6; color:#fff; }
.aihist-page:disabled { opacity:.45; cursor:not-allowed; }
.aihist-pager-info { font-size:12px; color:#94a3b8; margin-left:8px; }
@media (max-width: 1200px) { .aihist-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width: 768px) { .aihist-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
