:root {
  --bg: #0f1419;
  --bg2: #161c24;
  --panel: #1b232e;
  --panel2: #212c39;
  --line: #2c3848;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #2f81f7;
  --accent2: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; white-space: nowrap; }
.search-box { flex: 1; max-width: 360px; position: relative; margin: 0 8px; }
.search-input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 400px; overflow-y: auto;
}
.search-count { padding: 8px 12px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.search-empty { padding: 16px 12px; color: var(--muted); text-align: center; }
.search-result {
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.search-result:hover { background: var(--panel2); }
.sr-sheet { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; white-space: nowrap; }
.sr-label { font-weight: 500; font-size: 13px; }
.sr-field { color: var(--muted); font-size: 12px; }
.menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.sync-group { display: flex; gap: 8px; }
.ghost-btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.ghost-btn:hover { border-color: var(--accent); }

/* 布局 */
.layout { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 180px; flex-shrink: 0; background: var(--bg2);
  border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  text-align: left; background: none; border: none; color: var(--muted);
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.content { flex: 1; padding: 16px; overflow-x: auto; }

/* 总览 */
.encourage {
  background: linear-gradient(90deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
  font-size: 15px; margin-bottom: 16px;
}
.encourage .date { float: right; color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.card.accent { border-color: var(--accent); }
.card-val { font-size: 22px; font-weight: 700; }
.card-title { color: var(--muted); font-size: 12px; margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.muted { color: var(--muted); }
.block { width: 100%; margin-top: 10px; }

/* 待办 / 风险 / 跟进 */
.todo-list, .risk-list, .follow-list { list-style: none; margin: 0; padding: 0; }
.todo-list li, .risk-list li, .follow-list li { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; background: var(--panel2); }
.todo { display: flex; align-items: center; gap: 8px; }
.todo .prio { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--line); }
.prio-high { color: var(--red); } .prio-mid { color: var(--yellow); } .prio-low { color: var(--muted); }
.todo .due { margin-left: auto; color: var(--muted); font-size: 12px; }
.risk-red { border-left: 3px solid var(--red); }
.risk-yellow { border-left: 3px solid var(--yellow); }
.risk-list li.risk-red { background: rgba(248,81,73,.12); }
.risk-list li.risk-yellow { background: rgba(210,153,34,.12); }

/* 表格 */
.sheet-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sheet-bar .count { color: var(--muted); font-size: 13px; }
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-left: auto; }
.vs-btn { background: var(--panel2); border: none; color: var(--text-2); padding: 5px 12px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--border); }
.vs-btn:last-child { border-right: none; }
.vs-btn.active { background: var(--accent); color: #fff; }
/* 甘特图 */
.gantt-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
.gantt { display: block; max-width: 100%; }
.gantt-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; }
.lg-item i { display: inline-block; width: 16px; height: 10px; border-radius: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th, .data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.data-table th { background: var(--panel2); position: sticky; top: 0; }
.data-table tr.risk-red td { background: rgba(248,81,73,.1); }
.data-table tr.risk-yellow td { background: rgba(210,153,34,.1); }
.data-table .long { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 220px; }
.op-col { width: 90px; }
.op { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px; margin-right: 4px; }
.op:hover { border-color: var(--accent); }
.op.del { color: var(--red); }
.op.del:hover { border-color: var(--red); }
.op.items { color: var(--accent2); border-color: var(--accent2); }
.op.items:hover { background: rgba(63,185,80,.12); }

/* 按钮 */
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 13px; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 13px; }

/* 表单 */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.fld { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; }
.fld:focus { outline: none; border-color: var(--accent); }
textarea.fld { min-height: 72px; resize: vertical; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-mask[hidden] { display: none; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 460px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-x { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-body { padding: 16px; max-height: 60vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* 统计条 */
.bar-row { margin-bottom: 12px; }
.bar-label { font-size: 13px; margin-bottom: 4px; }
.bar-sub { color: var(--muted); font-size: 12px; }
.bar-track { background: var(--panel2); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

/* 栏目设置 */
.field-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field-item { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.field-item.locked { opacity: .8; }
.field-name { font-weight: 500; }
.field-type { color: var(--muted); font-size: 12px; margin-left: auto; }
.field-ops { display: flex; gap: 4px; }

/* 项目事项时间线 */
.modal-lg { max-width: 640px; }
.item-add-area { background: var(--panel2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.item-add-bar { display: flex; gap: 10px; align-items: flex-end; margin-top: 8px; flex-wrap: wrap; }
.mini-label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.mini-input { width: auto !important; min-width: 100px; }
.item-summary { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 0; }
.timeline-item { position: relative; padding: 0 0 14px 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline-item.done .tl-dot { background: var(--accent2); }
.timeline-body { background: var(--panel2); border-radius: 8px; padding: 10px 12px; }
.tl-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.tl-time { font-size: 12px; color: var(--muted); }
.item-status { font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.st-active { background: rgba(47,129,247,.2); color: var(--accent); }
.st-done { background: rgba(63,185,80,.2); color: var(--accent2); }
.item-due { font-size: 12px; color: var(--yellow); }
.item-text { font-size: 14px; line-height: 1.5; }
.timeline-item.done .item-text { text-decoration: line-through; opacity: .65; }
.item-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.item-ops { margin-top: 6px; display: flex; gap: 6px; }

/* 字段显隐切换 */
.field-toggle { margin-bottom: 14px; }
.field-toggle summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; }
.field-toggle summary:hover { color: var(--accent); }
.ft-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 4px; }
.ft-item { display: flex; align-items: center; gap: 4px; font-size: 13px; background: var(--panel2); padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.ft-item input { cursor: pointer; }
.ft-actions { display: flex; align-items: center; gap: 10px; padding: 8px 0 0; border-top: 1px dashed var(--border); margin-top: 6px; }
.ft-hint { font-size: 12px; color: var(--text-2); }
.btn-ghost { background: transparent; border: 1px dashed var(--border); color: var(--text); padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: var(--shadow); font-size: 14px; }

/* 移动端 */
@media (max-width: 720px) {
  .menu-btn { display: block; }
  .sidebar { position: fixed; top: 53px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; width: 200px; }
  .sidebar.open { transform: translateX(0); }
  .two-col { grid-template-columns: 1fr; }
  .search-box { max-width: none; order: 3; flex-basis: 100%; margin: 4px 0 0; }
  .topbar { flex-wrap: wrap; }
}
