* { box-sizing: border-box; }
:root {
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e4e8ed;
  --text: #202124;
  --text-2: #5f6368;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 10px;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; }
.hidden, [hidden] { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px 32px; box-shadow: var(--shadow); text-align: center; }
.login-mark, .brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; letter-spacing: .5px; }
.login-card h1 { margin: 18px 0 8px; font-size: 24px; }
.login-sub { color: var(--text-2); margin: 0 0 28px; }
.login-hint { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* 按钮 */
.btn { border: 1px solid transparent; border-radius: 8px; padding: 10px 18px; cursor: pointer; font-weight: 500; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: #f1f3f4; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 布局 */
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 600; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-2); }
.badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-gray { background: #f1f3f4; color: var(--text-2); }
.badge-purple { background: #f3e8fd; color: #7627bb; }
.badge-blue { background: #e8f0fe; color: #1967d2; }
.badge-demo { background: #fef7e0; color: #b06000; }
.demo-role { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }

.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px; flex-shrink: 0; }
.sidebar-title { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; padding: 0 12px 10px; }
.nav-item { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 11px 14px; border-radius: 8px; cursor: pointer; color: var(--text-2); margin-bottom: 4px; }
.nav-item:hover { background: #f1f3f4; }
.nav-item.active { background: #e8f0fe; color: var(--primary); font-weight: 500; }
.sidebar-sep { height: 1px; background: var(--border); margin: 10px 12px 14px; }
.sidebar-footer { margin-top: 40px; padding: 16px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.hint-title { font-weight: 500; margin-bottom: 12px; color: var(--text); }
.hint-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-pending { background: #d81b60; }
.dot-research { background: #a1426f; }
.dot-scheduled { background: #f9ab00; }
.dot-progress { background: #1a73e8; }
.dot-done { background: #1e8e3e; }
.dot-suspended { background: #b3b300; }
.dot-invalid { background: #9aa0a6; }

.main { flex: 1; padding: 28px 32px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 20px; }
.page-head h2 { margin: 0 0 6px; font-size: 22px; }
.page-sub { margin: 0; color: var(--text-2); font-size: 13px; }
.stats { display: flex; gap: 20px; }
.stat { text-align: center; }
.stat-num { font-size: 22px; font-weight: 600; }
.stat-label { font-size: 12px; color: var(--text-2); }

/* 需求池筛选与表格 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
.filter-bar input[type=search], .filter-bar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: #fff; color: var(--text); }
.filter-bar input[type=search] { flex: 1 1 200px; min-width: 160px; }
.filter-bar input[type=search]:focus, .filter-bar select:focus { border-color: var(--primary); }
.pool-meta { font-size: 12px; color: var(--text-2); margin: 0 2px 10px; }
.pool-table { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pool-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) .7fr .9fr .7fr .55fr .9fr .85fr 1fr .8fr; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f1f3f4; font-size: 13px; }
.pool-row:last-child { border-bottom: none; }
.pool-row:not(.pool-head):hover { background: #f8f9fa; cursor: pointer; }
.pool-head { background: #f8f9fa; color: var(--text-2); font-size: 12px; font-weight: 500; }
.pool-title { font-weight: 500; line-height: 1.4; }
.muted { color: var(--text-2); }
.external-link { color: var(--primary); text-decoration: none; font-size: 12px; }
.external-link:hover { text-decoration: underline; }
.title-with-link { display: inline-flex; align-items: center; gap: 4px; }
.status-chip { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; background: #f1f3f4; color: var(--text-2); }
.status-pending { background: #fde7f0; color: #b01254; }
.status-research { background: #f9e7f0; color: #93416f; }
.status-scheduled { background: #fef0d9; color: #b06000; }
.status-in_progress { background: #d7e9fb; color: #1967d2; }
.status-done { background: #dff2e4; color: #137333; }
.status-suspended { background: #f7f7cf; color: #767600; }
.status-invalid { background: #f1f3f4; color: #5f6368; }

/* 看板列 */
.board-columns { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.column { background: #eef1f5; border-radius: 12px; padding: 12px; min-height: 200px; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-weight: 600; }
.column-count { background: #dfe3e8; color: var(--text-2); border-radius: 10px; padding: 2px 9px; font-size: 12px; font-weight: 500; }

/* 需求卡片 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; transition: .15s; }
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); transform: translateY(-1px); }
.card-title { font-weight: 500; line-height: 1.5; margin-bottom: 8px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: #f1f3f4; color: var(--text-2); }
.chip-date { background: #fef7e0; color: #b06000; }
.chip-priority-high { background: #fce8e6; color: #c5221f; }
.chip-feishu { background: #e6f4ea; color: #137333; }
.chip-feishu-err { background: #fce8e6; color: #c5221f; }
.card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); padding-top: 10px; border-top: 1px solid #f1f3f4; }
.card-actions { display: flex; gap: 6px; }
.card-actions button { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--primary); }
.card-actions button:hover { background: #e8f0fe; }
.empty { text-align: center; color: var(--text-2); padding: 30px 10px; font-size: 13px; }

/* 迭代 */
.iteration-list { display: grid; gap: 16px; }
.iteration-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.iteration-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.iteration-head h3 { margin: 0 0 4px; font-size: 16px; }
.iteration-goal { color: var(--text-2); font-size: 13px; margin: 0; }
.iteration-date { font-size: 12px; color: var(--text-2); }
.iteration-summary { color: var(--text-2); font-size: 13px; padding: 12px 14px; background: #f8f9fa; border-radius: 8px; }
.iteration-items { display: grid; gap: 8px; }
.iteration-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8f9fa; border-radius: 8px; cursor: pointer; }
.iteration-item:hover { background: #eef1f5; }
.iteration-item .title { flex: 1; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(32,33,36,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 14px; width: 100%; max-width: 480px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--text-2); line-height: 1; }
.modal-body { padding: 20px 24px; overflow-y: auto; min-height: 0; }
.modal-title { font-weight: 500; background: #f8f9fa; padding: 12px; border-radius: 8px; margin: 0 0 20px; line-height: 1.5; }
.field-label { display: block; font-size: 13px; font-weight: 500; margin: 16px 0 8px; }
.field-label:first-child { margin-top: 0; }
.modal-body input[type=text], .modal-body input[type=date], .modal-body textarea, .modal-body select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; }
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus { border-color: var(--primary); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-group { display: grid; gap: 10px; }
.radio { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); flex: 0 0 auto; }
.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size: 13px; line-height: 1.6; }
.detail-label { color: var(--text-2); }
.detail-value { word-break: break-word; }
.error-text { color: #d93025; font-size: 13px; margin-top: 12px; }

/* Toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #202124; color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,.2); }

@media (max-width: 1100px) {
  .pool-row { grid-template-columns: minmax(180px, 2fr) .8fr .7fr .9fr .85fr; }
  .pool-row > span:nth-child(2), .pool-row > span:nth-child(5),
  .pool-row > span:nth-child(8), .pool-row > span:nth-child(9) { display: none; }
}
@media (max-width: 900px) {
  .board-columns { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 16px; }
  .pool-row { grid-template-columns: minmax(140px, 2fr) .7fr .9fr; }
  .pool-row > span:nth-child(2), .pool-row > span:nth-child(3),
  .pool-row > span:nth-child(5), .pool-row > span:nth-child(6),
  .pool-row > span:nth-child(8), .pool-row > span:nth-child(9) { display: none; }
  .stats { gap: 12px; }
}
