/* ============================================================================
   IP金牌策略大师（ip-celuedashi）统一工作台展示层（2026-10-19）
   作用域：仅 html body #agent-page[data-ip-strategy-root]（app.js 在渲染
   ip-celuedashi 时设置该根标记，切换其他智能体时移除）。

   复用 PROJECT_RULES §8.5.1 已验证的通用工作台能力：
   - 桌面 25:75 原生 Grid、流式宽度（取消固定上限）
   - 工作台自身 container-type + Container Query（981/980）控制窄屏堆叠
   - 桌面双面板视口有界等高（100dvh − 125px，min 420px）
   - 左侧输入区内滚、生成按钮贴底；右侧结果区独立内滚；结果单栏自然高度
   - 窄屏自然上下堆叠与整页滚动（不锁页面高度）
   在该智能体上补充：输入区“模板下载”次按钮、输出区“导出 Word / 导出 PDF”
   （与该智能体已有 actions 对齐）与“一键复制”统一为 §8 次按钮规格。
   仅调整展示层；输入字段、上传控件、必填校验、生成、复制、导出与生成内容
   均沿用现有实现（上传控件样式由 libs/upload-control-presentation.css 统一提供）。
   颜色全部取自 §8 token：
   #FF5A5F / #CC3A3F / #111111 / #555555 / #999999 / #EBEBEB / #F7F8FA / #FFFFFF。
   ============================================================================ */

/* ---------- 页面与工作台外壳 ---------- */
html body #agent-page[data-ip-strategy-root] {
    background: #F7F8FA !important;
    height: auto !important;
    overflow: visible !important;
}
html body #agent-page[data-ip-strategy-root] #agent-work-main {
    container-type: inline-size;
    container-name: ip-workbench;
    background: #F7F8FA !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 26px 38px !important;
    gap: 12px !important;
    max-width: none;
    margin: 0 auto;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}
html body #agent-page[data-ip-strategy-root] #agent-work-main > .agent-univ-header {
    padding: 19px 2px 17px !important;
    margin: 0 !important;
    border: 0 !important;
}
html body #agent-page[data-ip-strategy-root] .agent-univ-title {
    color: #111111 !important;
    font-size: 25px !important;
    font-weight: 700 !important;
    letter-spacing: -.5px;
}
html body #agent-page[data-ip-strategy-root] .agent-univ-header-desc {
    color: #555555 !important;
    font-size: 13px !important;
}

/* ---------- 双栏网格（宽屏 25:75；窄屏改单列） ---------- */
html body #agent-page[data-ip-strategy-root] .agent-workspace-grid {
    display: grid !important;
    grid-template-columns: minmax(255px, 1fr) minmax(0, 3fr) !important;
    align-items: stretch !important;
    gap: 16px !important;
    max-width: none !important;
    max-height: none !important;
    transition: none !important;
}
html body #agent-page[data-ip-strategy-root] :is(.univ-input-col, .univ-output-col) {
    display: flex !important;
    flex-direction: column !important;
    position: static !important;
    top: auto !important;
    height: auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* ---------- 白色主面板（§8 卡片：白底 / #EBEBEB 边框 / 圆角 14 / 轻阴影） ---------- */
html body #agent-page[data-ip-strategy-root] :is(.univ-input-card, .univ-output-card) {
    background: #FFFFFF !important;
    border: 1px solid #EBEBEB !important;
    border-radius: 14px !important;
    padding: 22px 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    backdrop-filter: none !important;
    min-height: 0 !important;
}
html body #agent-page[data-ip-strategy-root] :is(.univ-input-card > div:first-child, .univ-output-card > div:first-child) {
    min-height: 50px;
    margin: 0 0 20px !important;
    padding: 0 0 15px !important;
    border-bottom: 1px solid #EBEBEB !important;
    gap: 10px !important;
}
html body #agent-page[data-ip-strategy-root] :is(.univ-input-card h2, .univ-output-card h3) {
    color: #111111 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: -.2px;
}

/* ---------- 输入区（保留原有字段数量、标签、占位符与必填项） ---------- */
html body #agent-page[data-ip-strategy-root] .univ-field { margin-bottom: 17px !important; }
html body #agent-page[data-ip-strategy-root] .univ-field label {
    color: #111111 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.6 !important;
    margin-bottom: 8px !important;
}
html body #agent-page[data-ip-strategy-root] .univ-field-required { color: #FF5A5F !important; }
html body #agent-page[data-ip-strategy-root] [data-univ-field] {
    background: #FFFFFF !important;
    border: 1px solid #EBEBEB !important;
    border-radius: 8px !important;
    color: #111111 !important;
    font-size: 14px !important;
    line-height: 1.7 !important;
    min-height: 96px;
}
html body #agent-page[data-ip-strategy-root] [data-univ-field]:focus {
    outline: none !important;
    border-color: #FF5A5F !important;
    box-shadow: 0 0 0 3px rgba(255, 90, 95, 0.12) !important;
}
html body #agent-page[data-ip-strategy-root] [data-univ-field]::placeholder { color: #999999 !important; }

/* ---------- 输入区“模板下载”次按钮（§8 次按钮规格） ---------- */
html body #agent-page[data-ip-strategy-root] #download-template {
    background: #FFFFFF !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    color: #1A1A1A !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
}
html body #agent-page[data-ip-strategy-root] #download-template * { color: inherit !important; }
html body #agent-page[data-ip-strategy-root] #download-template:hover {
    color: #FF5A5F !important;
    border-color: #FF5A5F !important;
}
html body #agent-page[data-ip-strategy-root] #download-template:disabled {
    color: #999999 !important;
    border-color: #EBEBEB !important;
    cursor: wait;
}

/* ---------- 生成区与主按钮（§8：品牌 #FF5A5F / hover #CC3A3F / 圆角 8） ---------- */
html body #agent-page[data-ip-strategy-root] .univ-generate-block {
    border-top: 1px solid #EBEBEB !important;
}
html body #agent-page[data-ip-strategy-root] .univ-generate-block p {
    color: #999999 !important;
    font-size: 12px !important;
    line-height: 1.7 !important;
}
html body #agent-page[data-ip-strategy-root] #generate-btn {
    width: 100%;
    background: #FF5A5F !important;
    border: 0 !important;
    border-radius: 8px !important;
    color: #FFFFFF !important;
    min-height: 46px;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
}
html body #agent-page[data-ip-strategy-root] #generate-btn * { color: #FFFFFF !important; }
html body #agent-page[data-ip-strategy-root] #generate-btn:hover { background: #CC3A3F !important; }
html body #agent-page[data-ip-strategy-root] #generate-btn:disabled {
    background: #FFBCBE !important;
    cursor: wait;
}

/* ---------- 输出区工具条：复制 / 导出 Word / 导出 PDF（§8 次按钮） ---------- */
html body #agent-page[data-ip-strategy-root] :is(#copy-output, #export-word, #export-pdf) {
    background: #FFFFFF !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    color: #1A1A1A !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
}
html body #agent-page[data-ip-strategy-root] :is(#copy-output, #export-word, #export-pdf) * { color: inherit !important; }
html body #agent-page[data-ip-strategy-root] :is(#copy-output, #export-word, #export-pdf):hover {
    color: #FF5A5F !important;
    border-color: #FF5A5F !important;
}
html body #agent-page[data-ip-strategy-root] :is(#copy-output, #export-word, #export-pdf):disabled {
    color: #999999 !important;
    border-color: #EBEBEB !important;
    cursor: wait;
}

/* ---------- 输出结果区：透明底、内滚、4K 阅读行宽 ---------- */
html body #agent-page[data-ip-strategy-root] #agent-output {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    /* 该智能体输出为纯文本（text + <br>，无块级包裹），4K 下需在同层限制行宽：
       右侧留白 = 容器宽度 − 64rem − 基础内边距；滚动条仍保持面板右缘。 */
    padding-right: max(20px, calc(100% - 64rem - 20px)) !important;
}
/* 输出始终单栏；4K 宽屏下正文保持可读行宽（64rem），工作台整体仍为流式 75%。 */
html body #agent-page[data-ip-strategy-root] #agent-output .simple-output-list {
    grid-template-columns: 1fr !important;
}
html body #agent-page[data-ip-strategy-root] #agent-output > :where(p, ul, ol, pre, blockquote, h1, h2, h3, h4, h5, h6, table) {
    max-width: 64rem;
}
html body #agent-page[data-ip-strategy-root] #agent-output .simple-output-detail dd {
    max-width: 64rem;
}
html body #agent-page[data-ip-strategy-root] #agent-output > .absolute {
    color: #999999 !important;
}

/* ---------- 宽屏：单行有界等高 + 左右独立滚动（§8.5.1 通用机制） ---------- */
@container ip-workbench (min-width: 981px) {
    /* 选择器携带 #agent-work-main，压过 styles.css 既有
       `#agent-work-main > div { height: auto !important }`（特异性 2,2,2）。 */
    html body #agent-page[data-ip-strategy-root] #agent-work-main .agent-workspace-grid {
        height: calc(100dvh - 125px) !important;
        min-height: 420px;
    }
    html body #agent-page[data-ip-strategy-root] .univ-input-card {
        height: 100% !important;
        max-height: none !important;
        overflow: hidden !important;
    }
    html body #agent-page[data-ip-strategy-root] .univ-input-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    html body #agent-page[data-ip-strategy-root] .univ-output-card {
        height: 100% !important;
        max-height: none !important;
        overflow: hidden !important;
    }
    html body #agent-page[data-ip-strategy-root] #agent-output {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* ---------- 窄屏：上下堆叠 + 自然页面滚动（不锁高度） ---------- */
@container ip-workbench (max-width: 980px) {
    html body #agent-page[data-ip-strategy-root] #agent-work-main .agent-workspace-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
        height: auto !important;
    }
    html body #agent-page[data-ip-strategy-root] .univ-input-card,
    html body #agent-page[data-ip-strategy-root] .univ-output-card {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    html body #agent-page[data-ip-strategy-root] .univ-input-body,
    html body #agent-page[data-ip-strategy-root] #agent-output {
        flex: none !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
}
