/* ============================================================
   组件样式
   ============================================================ */

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.card-title {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .sub { font-weight: 400; color: var(--text-3); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 550;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-weak); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* ---------- 头像 ---------- */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 650;
  font-size: 13px;
  flex-shrink: 0;
  user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

/* ---------- 表单段 ---------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.table th { color: var(--text-3); font-weight: 600; font-size: 12px; background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- 空状态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--text-3);
  text-align: center;
}
.empty .eicon {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--surface-3); display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

/* ---------- 统计卡片 ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.stat .stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.stat .stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.stat .stat-foot { font-size: 12px; color: var(--text-2); }
.stat .stat-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent);
}

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pop .18s ease;
}
.modal.lg { max-width: 640px; }
.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  border: none; background: transparent; color: var(--text-3);
  font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; align-items: center;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: #047857; }
.toast.err { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 进度条 ---------- */
.progress {
  height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- 里程碑进度 ---------- */
.ms-list { display: flex; flex-direction: column; gap: 16px; }
.ms-item { }
.ms-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.ms-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ms-name .ms-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ms-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.ms-meta.overdue { color: var(--danger); font-weight: 600; }
.ms-progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ms-progress > span { display: block; height: 100%; border-radius: 999px; transition: width .25s; }

/* ---------- 看板卡片里程碑标签 ---------- */
.kb-card .kc-ms {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  white-space: nowrap;
}
.kb-card .kc-ms .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
