/* ============================================================
   布局样式
   ============================================================ */

/* ---------- 侧边栏 ---------- */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 8px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.5px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--sidebar-fg-dim); font-size: 11px; }

#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  color: var(--sidebar-fg);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-active-bar);
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }

.sidebar-foot {
  font-size: 11.5px; color: var(--sidebar-fg-dim);
  display: flex; align-items: center; gap: 7px; padding: 8px;
}
.sidebar-foot .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
}
.brand-logo svg { width: 22px; height: 22px; }

/* ---------- 侧边栏：新建项目按钮 ---------- */
.sidebar-actions { margin-top: 4px; }
.new-project-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.new-project-btn:hover { filter: brightness(1.07); }
.new-project-btn:active { transform: translateY(1px); }
.new-project-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- 主区 ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar-titles { min-width: 0; }
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
#app-content { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }

/* ---------- 项目切换器 ---------- */
.proj-switch { position: relative; flex-shrink: 0; }
.proj-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  cursor: pointer; max-width: 230px;
}
.proj-trigger:hover { background: var(--surface-3); }
.proj-trigger .proj-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-trigger svg { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
.proj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.proj-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 8px; min-width: 240px; max-height: 70vh; overflow: auto;
}
.proj-menu.hide { display: none; }
.proj-menu-head { font-size: 11.5px; color: var(--text-3); font-weight: 600; padding: 4px 10px 8px; }
.proj-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: var(--r-sm);
  padding: 9px 10px; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.proj-item:hover { background: var(--surface-3); }
.proj-item.sel { background: var(--accent-weak); color: var(--accent-strong); font-weight: 600; }
.proj-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.proj-item.proj-action { color: var(--text-2); font-weight: 500; }
.proj-menu-div { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- 项目管理弹窗行 ---------- */
.pm-list { display: flex; flex-direction: column; gap: 10px; }
.pmrow { display: flex; align-items: center; gap: 10px; }
.pm-name { flex: 1; }

/* ---------- 通用网格 ---------- */
.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.dash-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
@media (max-width: 1000px) {
  .cols-2, .cols-3, .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- 仪表盘列表 ---------- */
.mini-list { display: flex; flex-direction: column; gap: 10px; }
.mini-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm); background: var(--surface-2);
}
.mini-item .mi-main { flex: 1; min-width: 0; }
.mini-item .mi-title { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .mi-sub { font-size: 11.5px; color: var(--text-3); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart-wrap { display: flex; justify-content: center; }

/* ---------- 看板 ---------- */
.kb-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow);
}
.kb-toolbar .search { flex: 1; min-width: 200px; position: relative; }
.kb-toolbar .search input { padding-left: 34px; }
.kb-toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.kb-toolbar select { width: auto; min-width: 120px; }
.kb-filter-count { font-size: 12.5px; color: var(--text-3); margin-left: auto; }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) { .board { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 280px; overflow-x: auto; padding-bottom: 8px; } }

.kb-col {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 170px);
}
.kb-col.drop-active { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kb-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.kb-col-head .col-name { font-weight: 650; font-size: 13.5px; }
.kb-col-head .col-count {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  background: var(--surface); border-radius: 999px; padding: 1px 8px;
}
.kb-col-head .col-dot { width: 9px; height: 9px; border-radius: 50%; }
.kb-col-body {
  padding: 10px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; flex: 1; min-height: 60px;
}
.kb-add {
  margin: 0 10px 12px; padding: 8px; border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm); background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 550; transition: .15s;
}
.kb-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }

.kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: box-shadow .15s, transform .05s, border-color .15s;
  border-left: 3px solid var(--text-3);
}
.kb-card:hover { box-shadow: var(--shadow-md); }
.kb-card.dragging { opacity: .45; }
.kb-card .kc-title { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.kb-card .kc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.kb-card .kc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kb-card .kc-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.kb-card .kc-due { font-size: 11.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.kb-card .kc-due.overdue { color: var(--danger); font-weight: 600; }
.kb-empty { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 18px 8px; }

/* ---------- 看板空状态引导 ---------- */
.kb-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  min-height: 54vh;
  color: var(--text-2);
}
.kb-empty-state .es-illu { width: 150px; max-width: 62%; margin-bottom: 20px; }
.kb-empty-state .es-illu svg { width: 100%; height: auto; display: block; }
.kb-empty-state .es-title { font-size: 18px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.kb-empty-state .es-sub { font-size: 13.5px; color: var(--text-3); max-width: 400px; margin-bottom: 22px; line-height: 1.6; }
.kb-empty-state .es-tip { margin-top: 18px; font-size: 12px; color: var(--text-3); }

/* ---------- 仪表盘空状态引导 ---------- */
.dash-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 20px;
  min-height: 54vh;
  color: var(--text-2);
}
.dash-empty-state .des-illu { width: 120px; max-width: 50%; margin-bottom: 20px; }
.dash-empty-state .des-illu svg { width: 100%; height: auto; display: block; }
.dash-empty-state .des-title { font-size: 18px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.dash-empty-state .des-sub { font-size: 13.5px; color: var(--text-3); max-width: 400px; margin-bottom: 22px; line-height: 1.6; }

/* ---------- 团队成员 ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.member-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.member-top { display: flex; gap: 14px; align-items: center; }
.member-info .m-name { font-weight: 650; font-size: 15px; }
.member-info .m-role { font-size: 12.5px; color: var(--accent); font-weight: 550; }
.member-info .m-mail { font-size: 12px; color: var(--text-3); }
.member-stats { display: flex; gap: 8px; }
.member-stat {
  flex: 1; background: var(--surface-2); border-radius: var(--r-sm);
  padding: 9px 10px; text-align: center;
}
.member-stat .ms-v { font-weight: 700; font-size: 17px; }
.member-stat .ms-l { font-size: 11px; color: var(--text-3); }
.member-actions { display: flex; gap: 8px; }

/* ---------- 设置页 ---------- */
.settings-wrap { max-width: 760px; display: flex; flex-direction: column; gap: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.danger-zone { border-color: var(--danger); }
.danger-zone .card-title { color: var(--danger); }
.kv-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-2); }
.kv-row .v { font-weight: 600; }
