:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1c1f23;
  --ink-soft: #5b6169;
  --ink-faint: #98a0a8;
  --line: #e8eaed;
  --brand: #4a9e7f;
  --brand-soft: #eaf4ef;
  --blue: #3b82f6;
  --green: #16a34a;
  --purple: #7c6bd6;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); height: 100vh; overflow: hidden; }
#app { display: flex; height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 232px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-logo {
  padding: 6px 8px; border-radius: 10px; background: #ffffff; border: 1px solid var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: .5px;
  white-space: nowrap; box-shadow: 0 1px 3px rgba(74,158,127,.12);
}
.brand-title { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none;
  background: transparent; border-radius: 10px; font-size: 14px; color: var(--ink-soft);
  cursor: pointer; text-align: left; transition: .15s;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.nav-item.active .dot { opacity: 1; }

/* 对话记录区 */
.conv-section { flex: 1; display: flex; flex-direction: column; margin-top: 14px; min-height: 0; }
.conv-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 8px; font-size: 12px; color: var(--ink-faint); }
.conv-head button { border: none; background: transparent; color: var(--brand); font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 6px; font-weight: 600; }
.conv-head button:hover { background: var(--brand-soft); }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv-item { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 9px; font-size: 13px; color: var(--ink-soft); cursor: pointer; transition: .12s; }
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.conv-item .ci-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .ci-del { opacity: 0; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.conv-item:hover .ci-del { opacity: 1; }
.conv-item .ci-del:hover { color: #ef4444; }

.sidebar-footer { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.footer-note { font-size: 11px; color: var(--ink-faint); text-align: center; }
.conv-item .ci-edit { opacity: 0; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 12px; padding: 0 2px; }
.conv-item:hover .ci-edit { opacity: 1; }
.conv-item .ci-edit:hover { color: var(--brand); }
.ci-rename-input { flex: 1; border: 1px solid var(--brand); border-radius: 6px; padding: 4px 6px; font-size: 13px; font-family: inherit; outline: none; min-width: 0; }

.login-note { font-size: 11px; color: var(--ink-faint); text-align: center; }
.settings-btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; margin-top: 8px; }
.settings-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- 主区域 ---------- */
.main { flex: 1; overflow: hidden; position: relative; }
.view { display: none; height: 100%; flex-direction: column; }
.view.active { display: flex; }
.view-header { padding: 24px 32px 16px; border-bottom: 1px solid var(--line); }
.view-header h1 { font-size: 20px; font-weight: 600; }
.view-desc { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: flex-end; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- 对话 ---------- */
.chat-messages { flex: 1; overflow-y: auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; max-width: 76%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: grid;
  place-items: center; font-size: 13px; font-weight: 600; color: #fff;
}
.msg.ai .avatar { background: var(--brand); }
.msg.user .avatar { background: var(--blue); }
.msg .bubble {
  padding: 11px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.msg.ai .bubble { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 3px; }
.msg.user .bubble { background: var(--blue); color: #fff; border-top-right-radius: 3px; }
.msg .bubble.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--brand); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.chat-empty { margin: auto; text-align: center; color: var(--ink-faint); }
.chat-empty .big { font-size: 15px; color: var(--ink-soft); margin-bottom: 6px; }

.chat-input-bar {
  display: flex; gap: 10px; padding: 16px 32px 22px; border-top: 1px solid var(--line);
  background: var(--panel);
}
#chat-input {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 14px; font-family: inherit; line-height: 1.5;
  max-height: 140px; outline: none; transition: .15s;
}
#chat-input:focus { border-color: var(--brand); }
.send-btn {
  padding: 0 22px; background: var(--brand); color: #fff; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer; align-self: stretch;
}
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 岗位统计条 & 筛选 ---------- */
.stat-bar { margin-top: 14px; font-size: 13px; color: var(--ink-soft); background: var(--bg); border-radius: 10px; padding: 10px 14px; display: inline-block; }
.stat-bar b { color: var(--brand); font-weight: 600; margin: 0 2px; font-size: 15px; }
.filter-bar { display: flex; gap: 10px; margin-top: 12px; }
.filter-bar select {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; font-size: 13px;
  font-family: inherit; background: #fff; color: var(--ink-soft); cursor: pointer; outline: none;
}
.filter-bar select:focus { border-color: var(--brand); }

/* 列表 */
.board-list { flex: 1; overflow: auto; padding: 20px 32px; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.tbl th, table.tbl td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); }
table.tbl th { background: var(--bg); color: var(--ink-soft); font-weight: 600; }
table.tbl tr:hover td { background: #fafbfc; cursor: pointer; }
.stage-pill { font-size: 12px; padding: 3px 10px; border-radius: 20px; }

/* ---------- 复盘 ---------- */
.review-list { flex: 1; overflow: auto; padding: 20px 32px; display: flex; flex-direction: column; gap: 12px; }
.review-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.review-card .rc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-card .rc-co { font-size: 14px; font-weight: 600; }
.review-card .rc-tag { font-size: 11px; padding: 2px 9px; border-radius: 20px; background: #eef1fb; color: var(--blue); }
.review-card .rc-desc { font-size: 13px; color: var(--ink); line-height: 1.6; }
.review-card .rc-sug { font-size: 12px; color: var(--green); margin-top: 8px; padding: 8px 10px; background: #edf9f0; border-radius: 8px; }
.review-card .rc-foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.chk { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- 空状态 ---------- */
.empty-state { margin: auto; text-align: center; color: var(--ink-faint); padding: 60px; }
.empty-state .es-title { font-size: 15px; color: var(--ink-soft); margin-bottom: 6px; }

/* ---------- 确认卡片 toast ---------- */
.toast-stack { position: absolute; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  width: 320px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast .t-title { font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; }
.toast .t-body { font-size: 14px; font-weight: 600; }
.toast .t-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.toast .t-actions { display: flex; gap: 8px; margin-top: 12px; }
.toast button { flex: 1; font-size: 12px; padding: 7px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.toast button.ok { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: grid; place-items: center; z-index: 100; }
.modal-mask[hidden] { display: none; }
.modal { width: 480px; background: var(--panel); border-radius: 16px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { font-size: 12px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 5px; }
.form-grid label.span2 { grid-column: 1 / -1; }
.form-grid input, .form-grid select {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit; outline: none;
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--brand); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.primary-btn { background: var(--brand); color: #fff; border: none; padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ghost-btn { background: #fff; border: 1px solid var(--line); padding: 9px 18px; border-radius: 10px; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.danger-btn { background: #fff; border: 1px solid #f3c7c7; color: #ef4444; padding: 9px 18px; border-radius: 10px; font-size: 13px; cursor: pointer; margin-right: auto; }

.seg { display: flex; background: var(--bg); border-radius: 9px; padding: 3px; }
.seg-btn { border: none; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-weight: 600; }

/* ---------- 设置弹窗 ---------- */
.settings-modal { width: 440px; }
.setting-block { margin-bottom: 22px; }
.setting-label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.setting-hint { font-size: 12px; color: var(--ink-faint); margin-bottom: 12px; }
.style-options { display: flex; flex-direction: column; gap: 10px; }
.style-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; cursor: pointer; transition: .15s;
}
.style-opt:hover { border-color: var(--brand); }
.style-opt.active { border-color: var(--brand); background: var(--brand-soft); }
.style-opt .so-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: grid; place-items: center; }
.style-opt.active .so-radio { border-color: var(--brand); }
.style-opt.active .so-radio::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.style-opt .so-text .so-name { font-size: 14px; font-weight: 500; }
.style-opt .so-text .so-desc { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.setting-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.setting-btns .ghost-btn, .setting-btns .danger-btn2 { flex: 1; text-align: center; }
.danger-btn2 { background: #fff; border: 1px solid #f3c7c7; color: #ef4444; padding: 9px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.danger-btn2:hover { background: #fef2f2; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8dce0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c3c8ce; }

/* 居中一闪提示（不拦截操作，1s 淡出）*/
.center-tip {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(28, 31, 35, .86); color: #fff; font-size: 14px;
  padding: 12px 22px; border-radius: 12px; z-index: 200; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: tipFade 1s ease forwards;
}
.center-tip[hidden] { display: none; }
@keyframes tipFade {
  0% { opacity: 0; transform: translate(-50%, -46%); }
  20% { opacity: 1; transform: translate(-50%, -50%); }
  70% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -54%); }
}

@media (max-width: 640px) {
  .sidebar { width: 200px; }
  .msg { max-width: 90%; }
  .view-header, .chat-messages, .chat-input-bar, .board-kanban, .board-list, .review-list { padding-left: 16px; padding-right: 16px; }
}
