/* 大佬秘书 · 简约科技感浅灰主题 */
:root {
  --bg: #f4f5f7;
  --bg-deep: #eceef1;
  --card: #ffffff;
  --border: #e2e5ea;
  --border-soft: #eceef2;
  --text: #1f2329;
  --text-2: #5a6472;
  --text-3: #8a94a3;
  --accent: #2b6de8;
  --accent-soft: #eaf1ff;
  --ok: #1fa56b;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
  --mono: "SF Mono", "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}
#app.layout { display: flex; flex-direction: row; height: 100vh; }

/* ===== 左侧边栏 ===== */
.sidebar {
  width: 212px; flex: 0 0 212px; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--border); z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px; border-bottom: 1px solid var(--border-soft); }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #1b1f27, #343b47);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
.brand-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.sidenav { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.sidenav .nav-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; text-align: left;
  color: var(--text-2); font-size: 13.5px; white-space: nowrap;
  border: none; background: transparent; transition: all .15s;
  display: flex; align-items: center; gap: 8px;
}
.sidenav .nav-item:hover { background: var(--bg-deep); color: var(--text); }
.sidenav .nav-item.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

.side-foot { padding: 10px 12px; border-top: 1px solid var(--border-soft); display: flex; align-items: center; gap: 8px; }
.gw-status {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3);
  padding: 5px 10px; border-radius: 999px; background: var(--bg-deep); flex: 1;
}
.gw-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: inline-block; }
.gw-status.on .dot { background: var(--ok); }
.gw-status.err .dot { background: var(--err); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 15px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.icon-btn:hover { background: var(--bg-deep); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ===== 工作区 ===== */
.workspace { flex: 1; overflow: hidden; position: relative; }
.panel {
  position: absolute; inset: 0; overflow-y: auto;
  padding: 20px 24px 48px;
  display: none; background: var(--bg);
}
.panel.active { display: block; }

/* 面板头部 */
.panel-head { margin-bottom: 18px; }
.panel-head h1 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-head p { color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .step-badge {
  width: 22px; height: 22px; border-radius: 7px; background: var(--accent);
  color: #fff; font-size: 12px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700;
}
.card-title .step-badge.done { background: var(--ok); }

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* 表单 */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input, .textarea, select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; color: var(--text);
  font-size: 13.5px; font-family: inherit; outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select.input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.textarea.square { aspect-ratio: 1 / 1; min-height: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 13.5px; cursor: pointer;
  transition: all .15s; font-family: inherit; font-weight: 500;
}
.btn:hover { background: var(--bg-deep); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #245ed4; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-deep); color: var(--text); }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { padding: 10px 22px; font-size: 14.5px; }

/* 上传区 */
.upload-zone {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer; color: var(--text-3);
  transition: all .15s; background: #fafbfc; position: relative;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 素材网格（可视化卡片） */
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mat-card {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #fff; cursor: pointer; transition: all .15s; position: relative;
}
.mat-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(43,109,232,.12); }
.mat-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.mat-media { aspect-ratio: 1 / 1; background: #0f1216; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mat-media img, .mat-media video { width: 100%; height: 100%; object-fit: cover; }
.mat-media.audio { background: linear-gradient(135deg, #eef2f7, #dfe5ee); color: #5a6472; font-size: 30px; }
.mat-meta { padding: 7px 9px; }
.mat-meta .name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-meta .sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.mat-card:hover .mat-actions { display: flex; }
.mat-actions button {
  width: 24px; height: 24px; border-radius: 6px; border: none; cursor: pointer;
  background: rgba(15,18,22,.75); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.mat-actions button:hover { background: var(--accent); }

/* 播放器 */
.player { width: 100%; margin-top: 10px; border-radius: 8px; background: #0f1216; }
.video-preview {
  width: 100%; aspect-ratio: 9 / 16; max-height: 420px; background: #0f1216;
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.video-preview video { width: 100%; height: 100%; object-fit: contain; }
.video-preview .ph { color: #8a94a3; font-size: 13px; text-align: center; padding: 20px; }

/* 进度条 */
.progress-wrap { margin: 10px 0; }
.progress-track { height: 6px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #5b93ff); transition: width .4s; }
.progress-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* 任务坞 */
.task-dock {
  position: fixed; right: 16px; bottom: 16px; width: 340px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.task-item {
  pointer-events: auto; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow);
}
.task-item .t-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.task-item .t-label { font-weight: 600; }
.task-item .t-status { color: var(--accent); font-size: 12px; }
.task-item.done .t-status { color: var(--ok); }

/* 结果区 */
.result-card { border: 1px solid var(--accent); background: linear-gradient(180deg, #f7faff, #fff); }
.result-card .card-title { color: var(--accent); }

/* 标签 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; background: var(--bg-deep); color: var(--text-2); }
.badge.ok { background: #e6f7ef; color: var(--ok); }
.badge.warn { background: #fdf3e3; color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* 分段选择器 */
.seg { display: inline-flex; background: var(--bg-deep); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; padding: 6px 13px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; font-family: inherit; transition: all .15s;
}
.seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1); }

/* 聊天 */
.chat-wrap { display: flex; gap: 16px; height: 100%; }
.chat-side { width: 250px; flex: 0 0 250px; display: flex; flex-direction: column; gap: 10px; }
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.chat-sess {
  padding: 9px 11px; border-radius: 9px; cursor: pointer; border: 1px solid transparent;
  transition: all .15s;
}
.chat-sess:hover { background: var(--bg-deep); }
.chat-sess.active { background: var(--accent-soft); border-color: var(--accent); }
.chat-sess .s-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sess .s-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg .ava { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.msg.user .ava { background: var(--accent-soft); color: var(--accent); }
.msg.assistant .ava { background: #1b1f27; color: #fff; }
.msg.sys .ava { background: var(--bg-deep); color: var(--text-3); }
.msg .bubble {
  background: var(--bg-deep); border-radius: 4px 12px 12px 12px; padding: 10px 14px;
  max-width: 82%; font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
}
.msg.user .bubble { background: var(--accent-soft); border-radius: 12px 4px 12px 12px; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--border); border-radius: 12px 12px 12px 4px; }
.bubble pre { background: #0f1216; color: #e6e8ec; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; font-family: var(--mono); }
.bubble code { font-family: var(--mono); font-size: 12.5px; }
.bubble .tool-line { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.thinking-block { font-size: 12px; color: var(--text-3); border-left: 2px solid var(--border); padding: 2px 10px; margin: 4px 0; }
.composer {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  background: #fff; align-items: flex-end;
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 13.5px; font-family: inherit; outline: none;
  max-height: 120px; line-height: 1.6;
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 配置 */
.config-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.config-nav { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.config-nav .cn-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px; transition: all .15s;
}
.config-nav .cn-item:hover { background: var(--bg-deep); }
.config-nav .cn-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row .input { font-family: var(--mono); font-size: 12.5px; }

/* 提示 */
.toast-wrap { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1b1f27; color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.18); animation: toastIn .2s ease;
  max-width: 70vw;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 骨架屏/空态 */
.empty { text-align: center; color: var(--text-3); padding: 40px 20px; font-size: 13px; }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .6; }

/* 杂项 */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.flex-1 { flex: 1; }
.muted { color: var(--text-3); }

/* ===== 数字人视频：左右分栏 ===== */
.dv-layout { display: grid; grid-template-columns: 460px minmax(0, 1fr); gap: 16px; align-items: start; }
.dv-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dv-right { min-width: 0; position: sticky; top: 0; }
.dv-right .card { display: flex; flex-direction: column; height: 100%; }
.dv-preview { flex: 1; min-height: 520px; }
@media (max-width: 900px) { .dv-layout { grid-template-columns: 1fr; } .dv-preview { min-height: 360px; } }
