:root {
    --primary: #2563eb;
    --bg: #f1f5f9;
    --sidebar: #0f172a;
    --text: #1e293b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

a { color: var(--primary); text-decoration: none; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #94a3b8; font-size: 12px; margin-bottom: 24px; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 13px; color: #475569; }
.login-box input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
.login-box input:focus { outline: none; border-color: var(--primary); }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: #cbd5e1; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { padding: 20px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid #1e293b; }
.brand-version { font-size: 11px; font-weight: 500; color: #64748b; margin-top: 2px; letter-spacing: 0.5px; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: block; padding: 12px 20px; color: #cbd5e1; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #1e293b; font-size: 13px; }
.sidebar-footer .role { color: #64748b; margin: 4px 0 8px; }
.sidebar-footer a { color: #94a3b8; }

.content { flex: 1; padding: 24px; }
h2 { margin-bottom: 20px; }
h2 small { color: #94a3b8; font-weight: normal; }
h3 { margin-bottom: 12px; }

/* 卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--border); text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: #64748b; margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h3 { margin: 0; }

/* 表单 */
label { display: block; margin: 12px 0 4px; font-size: 13px; color: #475569; }
input, select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
input:focus, select:focus { outline: none; border-color: var(--primary); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { flex: 0 0 auto; }

/* 按钮 */
.btn { display: inline-block; padding: 9px 16px; background: #fff; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled, .btn[disabled] { background: #e2e8f0; color: #94a3b8; border-color: #e2e8f0; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { background: #e2e8f0; color: #94a3b8; border-color: #e2e8f0; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; color: #475569; }
tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: #94a3b8; padding: 30px; }
.td-actions { white-space: nowrap; }
.td-actions .btn { margin-right: 6px; }
.td-actions .btn:last-child { margin-right: 0; }

/* 徽章/状态 */
.badge { background: #eff6ff; color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-running { background: #dbeafe; color: #1d4ed8; }
.status-done { background: #dcfce7; color: #15803d; }
.status-review, .status-paused { background: #fae8ff; color: #a21caf; }
.status-failed { background: #fee2e2; color: #dc2626; }
.badge-queued { background: #fef3c7; color: #b45309; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-done { background: #dcfce7; color: #15803d; }
.badge-failed { background: #fee2e2; color: #dc2626; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #dc2626; }

/* 步骤流 */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-name { font-weight: 600; }
.step-key { color: #94a3b8; font-size: 12px; }
.step-action { margin-top: 12px; }
.step-error { margin-top: 8px; color: #dc2626; font-size: 13px; }
.step-output { margin-top: 8px; background: #f8fafc; padding: 10px; border-radius: 6px; font-size: 12px; max-height: 150px; overflow: auto; white-space: pre-wrap; }
.step-body { margin-top: 12px; }

/* 键值列表（调研报告等结构化展示） */
.kv-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.kv-row { display: flex; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-key { width: 110px; flex-shrink: 0; padding: 10px 12px; background: #f8fafc; font-weight: 600; color: #475569; font-size: 13px; }
.kv-val { flex: 1; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.bullet-list { margin: 0; padding-left: 20px; }
.bullet-list li { margin: 4px 0; }

/* 风险表格 */
.risk-table { margin-top: 12px; font-size: 13px; }
.risk { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.risk-high { background: #fee2e2; color: #dc2626; }
.risk-medium { background: #fef3c7; color: #b45309; }
.risk-low { background: #dcfce7; color: #15803d; }

/* 提示词列表 */
.prompt-list { margin-top: 12px; }
.prompt-item { padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.prompt-text { margin-top: 6px; color: #475569; font-size: 12px; line-height: 1.5; }
.prompt-more { color: #94a3b8; font-size: 12px; margin-top: 6px; }

/* 图片/场景缩略图网格（紧凑、全部展示） */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.thumb-item { margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: #f8fafc; display: flex; flex-direction: column; }
.thumb-link { display: block; line-height: 0; }
.thumb-link img { width: 100%; height: 96px; object-fit: cover; border-radius: 4px; display: block; }
.thumb-cap { margin-top: 5px; font-size: 11px; color: #475569; text-align: center; line-height: 1.3; word-break: break-all; }
.thumb-tpl { display: block; color: #94a3b8; font-size: 10px; }

/* 场景模板表单 */
.hint { color: #64748b; font-size: 13px; margin-bottom: 16px; }
.scene-form .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.scene-form .form-grid input, .scene-form .form-grid select { width: 100%; }
.scene-form .form-actions { margin-top: 16px; display: flex; gap: 10px; }

/* 产品固定信息：尺寸变体表格 */
.variant-table { margin-top: 6px; }
.variant-table th, .variant-table td { padding: 6px 8px; font-size: 13px; }
.variant-table input { width: 100%; padding: 6px 8px; font-size: 13px; }
.variant-table .td-actions { white-space: nowrap; }

/* 创建任务：透明图 checkbox */
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #475569; margin: 0; cursor: pointer; }
.check-label input[type=checkbox] { width: 16px; height: 16px; margin: 0; cursor: pointer; }

/* 底板图管理 */
.backdrop-box { padding: 8px 0; }
.backdrop-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.backdrop-upload { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.backdrop-upload input[type=file] { flex: 1; padding: 6px; }
.bd-table { margin-top: 8px; }
.bd-table th, .bd-table td { padding: 8px 10px; font-size: 13px; }
.bd-thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.bd-name { font-size: 12px; color: #64748b; max-width: 180px; word-break: break-all; }
.bd-input { width: 64px; padding: 5px 6px; font-size: 13px; }
.bd-table .td-actions { white-space: nowrap; }

/* product white images */
.white-img-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.white-img-item { width: 180px; text-align: center; }
.white-img-item img { width: 180px; height: 180px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.white-img-item .btn { margin-top: 6px; }

/* auto-run progress bar */
.auto-progress { margin: 14px 0; padding: 14px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.auto-progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #1e293b; font-size: 14px; font-weight: 600; }
.ap-count { color: #64748b; font-size: 13px; font-weight: 500; }
.auto-progress-bar { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; margin-bottom: 12px; }
.auto-progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6); transition: width 0.4s ease; border-radius: 5px; }
.auto-progress-log { color: #334155; font-size: 13px; line-height: 1.5; }
.ap-list { list-style: none; margin: 0; padding: 0; }
.ap-step { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13px; color: #475569; border-bottom: 1px dashed #e2e8f0; }
.ap-step:last-child { border-bottom: none; }
.ap-icon { width: 20px; text-align: center; flex: none; }
.ap-name { flex: 1; }
.ap-status { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.3px; }
.ap-run .ap-name { color: #3b82f6; font-weight: 600; }
.ap-ok .ap-name { color: #16a34a; }
.ap-fail .ap-name { color: #dc2626; }
.ap-review .ap-name { color: #d97706; }

/* ===== A+ 页面预览 ===== */
.badge-aplus { background: #7c3aed; color: #fff; }
.aplus-toolbar { margin: 12px 0 20px; display: flex; gap: 10px; align-items: center; }
.aplus-module { background: #fff; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 20px; overflow: hidden; }
.aplus-module-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.aplus-module-head .tag { background: #eef2ff; color: #3730a3; font-size: 12px; padding: 3px 10px; border-radius: 4px; }
.aplus-banner { position: relative; }
.aplus-banner img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.aplus-banner-txt { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; background: rgba(0,0,0,.35); color: #fff; }
.aplus-banner-txt h3 { font-size: 24px; margin: 0 0 8px; }
.aplus-banner-txt p { font-size: 15px; margin: 0; }
.aplus-image-text { display: grid; grid-template-columns: 1fr 1fr; }
.aplus-image-text .ait-img { background: #f1f5f9; min-height: 240px; }
.aplus-image-text .ait-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aplus-image-text .ait-txt { padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.aplus-image-text .ait-txt h3 { font-size: 19px; margin: 0 0 12px; }
.aplus-image-text .ait-txt p { font-size: 14px; line-height: 1.7; color: #334155; margin: 0; }
.aplus-comparison { padding: 20px 24px; }
.aplus-comparison h3 { font-size: 18px; margin: 0 0 14px; }
.aplus-comparison table { width: 100%; border-collapse: collapse; }
.aplus-comparison th, .aplus-comparison td { border: 1px solid #e5e7eb; padding: 11px 12px; text-align: left; font-size: 14px; }
.aplus-comparison th { background: #f9fafb; font-weight: 600; width: 30%; color: #1e293b; }
.aplus-copy-panel { margin-top: 8px; }
.aplus-copy-panel textarea { width: 100%; min-height: 320px; padding: 14px; font-size: 13px; line-height: 1.6; font-family: monospace; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; }
@media (max-width: 640px) {
    .aplus-image-text { grid-template-columns: 1fr; }
    .aplus-image-text .ait-img { order: 0; }
}

/* ===== 站内信浮窗 ===== */
#msg-launcher {
    position: fixed; right: 24px; bottom: 24px; z-index: 9999;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 16px rgba(37,99,235,.35);
    transition: transform .15s;
}
#msg-launcher:hover { transform: scale(1.08); }
#msg-launcher.has-unread { animation: msg-pulse 1.8s ease-in-out infinite; }
@keyframes msg-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(37,99,235,.35); }
    50% { box-shadow: 0 0 0 8px rgba(37,99,235,.15); }
}
.msg-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 20px; height: 20px; padding: 0 5px;
    background: #ef4444; color: #fff; font-size: 12px; font-weight: 700;
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; box-sizing: border-box;
}
.msg-window {
    position: fixed; right: 24px; bottom: 88px; z-index: 9998;
    width: 360px; max-width: calc(100vw - 48px);
    height: 480px; max-height: calc(100vh - 120px);
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    display: flex; flex-direction: column; overflow: hidden;
}
.msg-window.msg-expanded { width: 600px; height: 620px; max-height: calc(100vh - 60px); }
.msg-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid var(--border);
}
.msg-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: #1e293b; }
.msg-unread-tag {
    background: #ef4444; color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 700;
}
.msg-head-actions { display: flex; gap: 6px; }
.msg-btn {
    width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: 14px; line-height: 1; color: #475569;
    display: flex; align-items: center; justify-content: center;
}
.msg-btn:hover { border-color: var(--primary); color: var(--primary); }
#msg-compose-btn { width: auto; padding: 0 10px; font-size: 13px; }
.msg-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.msg-tabs { display: flex; border-bottom: 1px solid var(--border); }
.msg-tab {
    flex: 1; padding: 10px; background: transparent; border: none; cursor: pointer;
    font-size: 14px; color: #64748b; border-bottom: 2px solid transparent;
}
.msg-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.msg-compose { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.msg-input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; box-sizing: border-box;
}
.msg-textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.msg-compose-actions { display: flex; justify-content: flex-end; gap: 8px; }
.msg-list { flex: 1; overflow-y: auto; }
.msg-empty { padding: 40px 0; text-align: center; color: #94a3b8; font-size: 14px; }
.msg-item { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.msg-item:hover { background: #f8fafc; }
.msg-item-unread { background: #eff6ff; }
.msg-item-unread .msg-item-head strong::after { content: ' ●'; color: #ef4444; font-size: 10px; vertical-align: middle; }
.msg-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.msg-item-head strong { font-size: 13px; color: #1e293b; }
.msg-item-time { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.msg-item-meta { font-size: 12px; color: #64748b; margin: 3px 0 5px; }
.msg-item-body {
    font-size: 13px; color: #475569; line-height: 1.6;
    word-break: break-word; white-space: pre-wrap;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ===== 任务列表筛选 + 分页 ===== */
.filter-form { display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.filter-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #475569; }
.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row select {
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; min-width: 150px; box-sizing: border-box;
}
.filter-row input[type="text"] { min-width: 200px; }
.pagination-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 16px; flex-wrap: wrap;
}
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination .btn-sm { text-decoration: none; }

/* ===== 权限编辑弹窗 ===== */
.modal {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
    background: #fff; border-radius: 12px; width: 520px; max-width: 92vw;
    max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head strong { font-size: 15px; }
.modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer; color: #64748b; line-height: 1;
}
.modal-close:hover { color: #1e293b; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--border);
}
.perm-role-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.perm-role-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #475569; }
.perm-role-row select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.perm-select-all { flex-direction: row !important; align-items: center; gap: 6px !important; }
.perm-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.perm-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer;
    font-size: 13px; color: #334155;
}
.perm-item:hover { background: #f8fafc; }
.perm-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.perm-item .hint { margin: 0 0 0 auto; font-size: 11px; color: #94a3b8; }

/* ===== 任务统计报表 ===== */
.page-head-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.table-scroll { overflow-x: auto; }
.report-cross { min-width: 600px; }
.report-cross th, .report-cross td { text-align: center; white-space: nowrap; padding: 8px 12px; }
.report-cross .sticky-col { text-align: left; position: sticky; left: 0; background: #f8fafc; z-index: 1; }
.report-cross thead .sticky-col { background: #eef2f7; z-index: 2; }
.report-cross tfoot .sticky-col { background: #f1f5f9; }
.report-cross .col-total { font-weight: 600; background: #f8fafc; }
.report-cross tfoot th { border-top: 2px solid var(--border); }

/* ===== 使用说明书 ===== */
.help-doc { max-width: 860px; }
.help-doc .panel-body { padding: 16px 20px; }
.help-doc .panel-body p, .help-doc .panel-body ul, .help-doc .panel-body ol { font-size: 14px; line-height: 1.8; color: #334155; }
.help-doc .panel-body ul, .help-doc .panel-body ol { padding-left: 22px; margin: 6px 0 12px; }
.help-doc .panel-body li { margin: 3px 0; }
.help-doc code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 13px; color: #c2410c; }
.help-toc-list { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 16px 20px; }
.help-toc-list a { font-size: 14px; color: #2563eb; text-decoration: none; }
.help-toc-list a:hover { text-decoration: underline; }
.help-faq dt { font-weight: 600; color: #1e293b; margin-top: 12px; }
.help-faq dd { margin: 4px 0 0; color: #475569; }
.help-doc h2 { margin-bottom: 6px; }
.help-doc .hint { margin-bottom: 16px; }
