/* ============ 设计系统：浅色 · 清爽 · 商务蓝 ============ */
:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --border: #E3E8F0;
  --border-strong: #CBD5E3;
  --text-1: #17233B;
  --text-2: #4A5872;
  --text-3: #8A97AD;
  --primary: #2F6FED;
  --primary-dark: #1F56C4;
  --primary-soft: #E8F0FE;
  --success: #16A34A;
  --success-soft: #E6F6EC;
  --warning: #D97706;
  --warning-soft: #FDF2E0;
  --danger: #DC2626;
  --danger-soft: #FDECEC;
  --purple: #7C3AED;
  --purple-soft: #F1EAFD;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23,35,59,.05), 0 4px 14px rgba(23,35,59,.06);
  --shadow-lg: 0 8px 30px rgba(23,35,59,.12);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text-1); font-size: 14px; line-height: 1.6; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text-1); }
a { color: var(--primary); text-decoration: none; }

/* ============ 登录页 ============ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #EAF1FD 0%, #F4F6FA 45%, #EEF7F0 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 32px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.auth-logo .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.auth-logo h1 { font-size: 18px; font-weight: 600; }
.auth-sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 8px; font-size: 14px; color: var(--text-2); }
.auth-tabs button.on { background: var(--surface); color: var(--text-1); font-weight: 600; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.inp { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1, #fff); font-size: 13.5px; outline: none; }
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; transition: background .15s, box-shadow .15s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text-1); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; padding: 11px; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.auth-hint { margin-top: 18px; padding: 12px; background: var(--primary-soft); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--primary-dark); line-height: 1.7; }
.form-err { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 20px; }

/* ============ 主布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; transition: transform .25s; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.side-logo .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.side-logo span { font-weight: 600; font-size: 15px; }
.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-group { padding: 14px 12px 6px; font-size: 11px; color: var(--text-3); letter-spacing: 1.5px; border-top: 1px solid var(--border); margin-top: 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; margin-bottom: 4px; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.side-user { padding: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.side-user .name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.side-user .role { font-size: 12px; color: var(--text-3); }
.logout-btn { margin-left: auto; color: var(--text-3); padding: 6px; border-radius: 6px; }
.logout-btn:hover { color: var(--danger); background: var(--danger-soft); }
.main { flex: 1; margin-left: 232px; padding: 24px 28px 60px; min-width: 0; }
.topbar { display: none; }

/* ============ 通用组件 ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 600; }
.page-head .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.grid { display: grid; gap: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12.5px; color: var(--text-3); }
.stat-card .num { font-size: 26px; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.stat-card .num small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip-todo { background: #EEF1F6; color: #5B6B84; }
.chip-doing { background: var(--primary-soft); color: var(--primary-dark); }
.chip-done { background: var(--success-soft); color: var(--success); }
.chip-p0 { background: var(--danger-soft); color: var(--danger); }
.chip-p1 { background: var(--warning-soft); color: var(--warning); }
.chip-p2 { background: #E8F0FE; color: var(--primary-dark); }
.empty { text-align: center; color: var(--text-3); padding: 40px 16px; font-size: 13.5px; }
.progress { height: 8px; border-radius: 999px; background: #EDF1F7; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .4s; }
.muted { color: var(--text-3); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }

/* 看板 */
.board { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.board-col h4 { font-size: 13.5px; font-weight: 600; padding: 4px 6px 10px; display: flex; align-items: center; gap: 8px; }
.board-col h4 .cnt { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--text-3); font-weight: 500; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.task-card .t-title { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.task-card .t-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.task-card .t-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.icon-btn { padding: 4px 7px; border-radius: 6px; color: var(--text-3); font-size: 12px; border: 1px solid transparent; }
.icon-btn:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border); }
.overdue { color: var(--danger); font-weight: 600; }

/* 通知铃铛 */
.bell-btn { margin-left: auto; position: relative; padding: 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2); display: flex; align-items: center; }
.bell-btn:hover { background: var(--surface-2); }
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }

/* 表格 */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.tbl th { background: var(--surface-2); color: var(--text-2); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }

/* 项目卡片 */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.milestone { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.milestone:last-child { border-bottom: none; }
.milestone .ms-check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: transparent; font-size: 11px; }
.milestone.done .ms-check { background: var(--success); border-color: var(--success); color: #fff; }
.milestone.done .ms-title { color: var(--text-3); text-decoration: line-through; }

/* 工具区 */
.tool-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tool-tabs button { padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; }
.tool-tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.editor-area { width: 100%; min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px;
  resize: vertical; outline: none; line-height: 1.9; }
.editor-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.title-list { display: grid; gap: 8px; margin-top: 14px; }
.title-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer; transition: border-color .15s; }
.title-item:hover { border-color: var(--primary); }
.title-item .idx { width: 22px; height: 22px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.fmt-out { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px;
  min-height: 200px; white-space: pre-wrap; line-height: 1.9; font-size: 13.5px; }

/* 日历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h3 { font-size: 16px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--text-3); padding: 6px 0; }
.cal-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 88px; padding: 6px; cursor: pointer; transition: border-color .15s; }
.cal-day:hover { border-color: var(--primary); }
.cal-day.out { opacity: .38; }
.cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47,111,237,.15); }
.cal-day .d { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.cal-ev { font-size: 11px; border-radius: 4px; padding: 1px 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.pf-wx { background: #07C160; } .pf-xhs { background: #FF2442; } .pf-dy { background: #161823; } .pf-sph { background: #F59E0B; }
.pf-chip-wx { background: #E5F8ED; color: #04914A; } .pf-chip-xhs { background: #FFE9EC; color: #E01B37; }
.pf-chip-dy { background: #E8E9EF; color: #161823; } .pf-chip-sph { background: #FEF3DF; color: #B47109; }

/* 复盘 */
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.chart-box h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.chart-box canvas { width: 100%; }
.insight { display: flex; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px; line-height: 1.7; }
.insight b { color: var(--primary-dark); }
.insight.warn { border-left-color: var(--warning); } .insight.warn b { color: var(--warning); }
.insight.good { border-left-color: var(--success); } .insight.good b { color: var(--success); }

/* 弹窗 / Toast */
.modal-mask { position: fixed; inset: 0; background: rgba(23,35,59,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; padding: 22px; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--text-1); color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 13.5px; z-index: 200; box-shadow: var(--shadow-lg); animation: toastIn .25s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 双栏表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.draft-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; border: 1px solid transparent; }
.draft-item:hover { background: var(--surface-2); }
.draft-item.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ============ 响应式 ============ */
@media (max-width: 1024px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 76px 16px 60px; }
  .topbar { display: flex; align-items: center; gap: 12px; position: fixed; top: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .topbar .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
  .topbar .tt { font-weight: 600; font-size: 15px; }
  .menu-btn { padding: 6px; border-radius: 8px; border: 1px solid var(--border); }
  .board { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .mask-side { position: fixed; inset: 0; background: rgba(23,35,59,.4); z-index: 35; }
  .cal-day { min-height: 64px; }
  .page-head h2 { font-size: 18px; }
}

/* ============ 数据复盘升级 ============ */
.pf-chip-sohu { background: #FFEDDC; color: #C2410C; } .pf-chip-bjh { background: #E1EBFF; color: #1D4FD7; }
.pf-chip-tt { background: #FBE3E1; color: #C02626; } .pf-chip-zh { background: #E0EEFF; color: #0052CC; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; color: var(--text-2); cursor: pointer; transition: all .15s; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.sel { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font-size: 13px; color: var(--text); font-family: inherit; }
.sec-tt { font-size: 16px; font-weight: 700; margin: 20px 0 10px; }
.center { text-align: center; }
.dropzone { border: 2px dashed var(--border); border-radius: 14px; padding: 28px 16px; text-align: center;
  color: var(--text-2); cursor: pointer; transition: all .15s; background: var(--bg); }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.imp-sum { margin: 12px 0 8px; padding: 10px 12px; border-radius: 10px; background: #E5F8ED; color: #04914A; font-size: 13px; }
.insight ol li { line-height: 1.6; }
@media (max-width: 860px) { .filter-bar { flex-direction: column; align-items: stretch; } }

/* ============ 评论与@提醒 ============ */
.mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); padding: 0 4px; border-radius: 4px; }
.cmt-sec { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.cmt-tt { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.cmt-list { max-height: 220px; overflow-y: auto; }
.cmt-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.cmt-item:last-child { border-bottom: none; }
.cmt-body { font-size: 13px; color: var(--text); line-height: 1.6; word-break: break-all; }
.mention-item { padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.mention-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.mention-item .m-content { font-size: 13px; line-height: 1.6; margin: 4px 0; word-break: break-all; }

/* ============ 复盘笔记 / API 配置 ============ */
.note-area { width: 100%; min-height: 110px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; resize: vertical; font-size: 13.5px; line-height: 1.7; outline: none; background: var(--surface); }
.note-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.note-view { white-space: pre-wrap; font-size: 13.5px; line-height: 1.8; color: var(--text-1); word-break: break-word; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 7px; border-radius: 6px; color: var(--text-2); word-break: break-all; }
