* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8; color: #1f2329; font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: #8a9099; font-size: 12px; }
.error { color: #d83931; font-size: 12px; min-height: 16px; }

/* 登录 */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef4ff, #f8fafc); }
.login-card { width: 320px; background: #fff; border-radius: 14px; padding: 28px;
  box-shadow: 0 10px 30px rgba(31,35,41,.12); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 18px; margin: 0; }
.login-card input { padding: 10px 12px; border: 1px solid #d9dee5; border-radius: 8px; font-size: 14px; }

/* 顶栏 */
.topbar { height: 52px; display: flex; align-items: center; gap: 24px; padding: 0 20px;
  background: #fff; border-bottom: 1px solid #e6e9ef; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; }
nav { display: flex; gap: 6px; flex: 1; }
.tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: #4e5969; font-size: 14px; }
.tab.active { background: #eaf2ff; color: #1a63d8; font-weight: 600; }
button { cursor: pointer; font-size: 14px; }
.primary { background: #1a63d8; color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; }
.primary:hover { background: #1454b8; }
.ghost { background: #fff; border: 1px solid #d9dee5; border-radius: 8px; padding: 6px 12px; color: #4e5969; }
.danger { background: #fff; border: 1px solid #f0c4c0; color: #d83931; border-radius: 8px; padding: 6px 12px; }

/* 布局 */
main { height: calc(100vh - 52px); }
.page { display: flex; height: 100%; }
.page.hidden { display: none; }
.side { width: 260px; border-right: 1px solid #e6e9ef; background: #fff; padding: 16px; overflow: auto; }
.side h2 { font-size: 13px; color: #8a9099; margin: 0 0 10px; font-weight: 500; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.list li:hover { background: #f5f7fa; }
.list li.active { background: #eaf2ff; border-color: #c9dcff; }
.list .name { font-weight: 600; }
.list .meta { font-size: 12px; color: #8a9099; margin-top: 2px; }
.editor { flex: 1; overflow: auto; padding: 20px 24px; }
.empty { color: #8a9099; padding: 40px; text-align: center; }

/* 工作流头 */
.wf-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.wf-head h1 { font-size: 18px; margin: 0 0 4px; }
.wf-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: #4e5969; }
.badge.live { background: #e6f7ee; color: #0f7b4d; }

/* 节点 */
.nodes { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.node-pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px;
  border: 1px solid #e6e9ef; background: #fff; cursor: pointer; width: fit-content; }
.node-pill.active { border-color: #1a63d8; background: #f3f8ff; }
.node-pill .type { font-size: 12px; color: #8a9099; }

.panel { background: #fff; border: 1px solid #e6e9ef; border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; color: #4e5969; }
input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid #d9dee5; border-radius: 8px;
  font-family: inherit; font-size: 13px; background: #fff; color: #1f2329;
}
textarea { resize: vertical; line-height: 1.6; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eef1f5; font-size: 13px; }
th { color: #8a9099; font-weight: 500; }
td input, td select { padding: 6px 8px; }
.log { background: #0f1720; color: #d7e0ea; padding: 16px; border-radius: 10px; overflow: auto;
  font-size: 12px; line-height: 1.6; max-height: 70vh; }
.test-out { background: #f7f9fc; border: 1px solid #eef1f5; border-radius: 10px; padding: 12px;
  white-space: pre-wrap; font-size: 12px; max-height: 340px; overflow: auto; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #eef2f7; color: #4e5969; }

/* 画布 */
.canvas-toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.canvas-scroll { height: 520px; overflow: auto; border: 1px solid #e6e9ef; border-radius: 12px;
  background-color: #fbfcfe;
  background-image: radial-gradient(#e3e8ef 1px, transparent 1px);
  background-size: 16px 16px; position: relative; }
.canvas-inner { position: relative; transform-origin: 0 0; }
.edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
#nodes-layer { position: absolute; inset: 0; }
.node-card { position: absolute; background: #fff; border: 1px solid #d9dee5; border-radius: 10px;
  padding: 9px 12px; cursor: grab; user-select: none; box-shadow: 0 2px 8px rgba(31,35,41,.06);
  transition: box-shadow .12s, border-color .12s; }
.node-card:hover { border-color: #b9c8da; }
.node-card.active { border-color: #1a63d8; box-shadow: 0 0 0 2px #d6e4ff, 0 2px 10px rgba(26,99,216,.15); }
.node-card.dragging { cursor: grabbing; z-index: 20; box-shadow: 0 10px 24px rgba(31,35,41,.18); }
.nc-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: #8a9099; }
.nc-model { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-port { position: absolute; top: 50%; margin-top: -4px; width: 8px; height: 8px; border-radius: 50%;
  background: #b6c4d2; border: 2px solid #fff; }
.nc-port.in { left: -5px; }
.nc-port.out { right: -5px; }

/* 数据表 */
.data-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.data-head h1 { font-size:18px; margin:0; }
.data-toolbar { display:flex; gap:8px; align-items:center; margin-bottom:10px; flex-wrap:wrap; }
.data-toolbar input { width: 260px; }
.grid-wrap { background:#fff; border:1px solid #e6e9ef; border-radius:12px; overflow:auto; max-height: 62vh; }
table.grid { width:100%; border-collapse:collapse; font-size:12px; }
table.grid th { position:sticky; top:0; background:#f7f9fc; z-index:1; white-space:nowrap; }
table.grid th, table.grid td { padding:8px 10px; border-bottom:1px solid #eef1f5; text-align:left; }
table.grid tr:hover td { background:#f8fbff; cursor:pointer; }
table.grid td.cell { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pager { display:flex; gap:8px; align-items:center; margin-top:10px; }
.badge-sm { font-size:11px; padding:1px 6px; border-radius:4px; background:#eef2f7; color:#4e5969; }

/* 弹窗 */
.modal { position:fixed; inset:0; background:rgba(15,23,32,.45); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal-card { background:#fff; border-radius:12px; width:min(720px, 92vw); max-height: 88vh; overflow:auto; padding:20px; }
.modal-card h3 { margin:0 0 12px; }
