/* ============================================================
   模块样式：用户模块 + 工作流模块
   ============================================================ */

/* ---------- 通用表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; height: 44px; border: 1px solid var(--border-2); border-radius: 10px;
  padding: 0 14px; font-size: 14px; background: #FBFBFD; outline: none; transition: .2s;
}
.field textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(108,92,231,.12);
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field .error { font-size: 12px; color: #EF4444; margin-top: 5px; display: none; }
.field.invalid input { border-color: #EF4444; }
.field.invalid .error { display: block; }

/* ============================================================
   登录 / 注册
   ============================================================ */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background:
    radial-gradient(700px 400px at 12% 0%, #EDE9FE 0%, transparent 55%),
    radial-gradient(700px 400px at 88% 100%, #FCE7F3 0%, transparent 55%), #F6F6FA; }
.auth-card { width: 100%; max-width: 880px; background: #fff; border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow-lg); display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand { background: var(--grad); color: #fff; padding: 48px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand .logo { color: #fff; }
.auth-brand .logo-mark { background: rgba(255,255,255,.22); box-shadow: none; }
.auth-brand h2 { font-size: 26px; font-weight: 800; line-height: 1.3; margin-top: 36px; }
.auth-brand p { margin-top: 12px; font-size: 14px; color: rgba(255,255,255,.85); }
.auth-brand .feats { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.auth-brand .feats div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255,255,255,.92); }
.auth-brand .feats .ic { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 14px; }
.auth-form { padding: 48px 44px; }
.auth-form h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-form .sub { font-size: 13.5px; color: var(--text-3); margin-bottom: 26px; }
.auth-tabs { display: flex; gap: 4px; background: #F2F2F8; border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tabs button { flex: 1; padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: .2s; }
.auth-tabs button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.auth-submit { width: 100%; height: 46px; background: var(--grad); color: #fff; border-radius: 12px; font-size: 15px; font-weight: 700; box-shadow: 0 8px 20px rgba(108,92,231,.3); transition: .2s; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(108,92,231,.4); }
.auth-note { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.auth-note a { color: var(--primary); }
.auth-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 20px; }
.auth-back:hover { color: var(--primary); }
@media (max-width: 760px) { .auth-card { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* ============================================================
   个人中心
   ============================================================ */
.profile-hero { background: #fff; border-bottom: 1px solid var(--border); }
.profile-cover { height: 150px; background: var(--grad); position: relative; }
.profile-main { display: flex; align-items: flex-end; gap: 20px; padding: 0 0 22px; margin-top: -44px; position: relative; }
.avatar-lg { width: 96px; height: 96px; border-radius: 24px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 38px; font-weight: 700; border: 4px solid #fff; box-shadow: var(--shadow); flex-shrink: 0; }
.profile-info { flex: 1; padding-top: 48px; min-width: 0; }
.profile-info h1 { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.profile-info .bio { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.profile-info .meta { font-size: 12.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 10px; padding-top: 48px; }
.profile-stats { display: flex; gap: 0; border-top: 1px solid var(--border); background: #fff; }
.pstat { flex: 1; text-align: center; padding: 16px 8px; cursor: pointer; transition: .15s; }
.pstat:hover { background: #F8F8FD; }
.pstat .n { font-size: 20px; font-weight: 800; }
.pstat .l { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.profile-tabs { display: flex; gap: 4px; margin: 20px 0; border-bottom: 1px solid var(--border); }
.profile-tabs .ptab { padding: 10px 18px; font-size: 14px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; transition: .18s; }
.profile-tabs .ptab:hover { color: var(--primary); }
.profile-tabs .ptab.active { color: var(--primary); border-bottom-color: var(--primary); }
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty-state .ic { font-size: 52px; margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ============================================================
   工作流广场
   ============================================================ */
.wf-hero { background: var(--grad); color: #fff; padding: 40px 0; position: relative; overflow: hidden; }
.wf-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 80% 0%, rgba(255,255,255,.18), transparent 60%); }
.wf-hero .container { position: relative; z-index: 1; }
.wf-hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.wf-hero p { font-size: 15px; color: rgba(255,255,255,.85); margin-top: 8px; }
.wf-hero .wf-cta { margin-top: 22px; display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--primary); padding: 11px 24px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.18); transition: .2s; }
.wf-hero .wf-cta:hover { transform: translateY(-2px); }
.wf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.wf-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: .2s; cursor: pointer; display: flex; flex-direction: column; }
.wf-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: transparent; }
.wf-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--grad-soft); overflow: hidden; }
.wf-thumb .art { width: 100%; height: 100%; object-fit: cover; }
.wf-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; }
.wf-thumb .play span { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--primary); display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow); opacity: 0; transform: scale(.8); transition: .2s; }
.wf-card:hover .play span { opacity: 1; transform: scale(1); }
.wf-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.wf-body .name { font-size: 16px; font-weight: 700; line-height: 1.4; }
.wf-body .desc { font-size: 13px; color: var(--text-3); margin-top: 6px; flex: 1; }
.wf-meta { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.wf-meta .author { display: flex; align-items: center; gap: 7px; }
.wf-meta .avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 10px; display: grid; place-items: center; }
@media (max-width: 960px) { .wf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .wf-grid { grid-template-columns: 1fr; } }

/* ============================================================
   工作流编辑器 (节点图)
   ============================================================ */
.editor-page { height: calc(100vh - 64px); display: flex; flex-direction: column; overflow: hidden; background: #EDEDF4; }
.editor-toolbar { height: 54px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 16px; flex-shrink: 0; }
.editor-toolbar .wf-name-input { font-size: 15px; font-weight: 700; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; outline: none; width: 220px; transition: .15s; }
.editor-toolbar .wf-name-input:hover, .editor-toolbar .wf-name-input:focus { border-color: var(--border-2); }
.editor-toolbar .spacer { flex: 1; }
.toolbar-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); border: 1px solid var(--border-2); transition: .15s; background: #fff; }
.toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.toolbar-btn.primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 6px 14px rgba(108,92,231,.3); }
.toolbar-btn.primary:hover { color: #fff; transform: translateY(-1px); }
.editor-main { flex: 1; display: flex; overflow: hidden; }
.node-palette { width: 224px; background: #fff; border-right: 1px solid var(--border); overflow-y: auto; flex-shrink: 0; padding: 14px; }
.node-palette h4 { font-size: 13px; color: var(--text-3); font-weight: 700; margin: 14px 0 8px; }
.node-palette h4:first-child { margin-top: 0; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; cursor: grab; font-size: 13.5px; font-weight: 500; transition: .15s; border: 1px solid transparent; margin-bottom: 4px; }
.palette-item:hover { background: #F5F4FF; border-color: var(--border-2); }
.palette-item .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.palette-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.5; background: #F7F7FB; padding: 10px 12px; border-radius: 10px; margin-top: 14px; }
.canvas-wrap { flex: 1; position: relative; overflow: hidden;
  background-image: radial-gradient(#C9C9D8 1px, transparent 1px); background-size: 22px 22px; }
.editor-canvas { position: absolute; top: 0; left: 0; width: 4000px; height: 3000px; transform-origin: 0 0; }
.conn-layer { position: absolute; inset: 0; pointer-events: none; }
.conn-layer path { fill: none; stroke-width: 2.5; }
.conn-layer path.temp { stroke-dasharray: 6 5; }

/* 节点 */
.node { position: absolute; width: 200px; background: #fff; border-radius: 12px; border: 1px solid var(--border-2); box-shadow: var(--shadow-sm); user-select: none; }
.node.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(108,92,231,.22), var(--shadow); }
.node-title { padding: 9px 12px; border-radius: 11px 11px 0 0; color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; cursor: grab; }
.node-title .ic { font-size: 13px; }
.node-title:active { cursor: grabbing; }
.node-body { padding: 8px 0; }
.port-row { position: relative; display: flex; align-items: center; height: 30px; padding: 0 12px; font-size: 12.5px; color: var(--text-2); }
.port-row .label { flex: 1; }
.port-row .value { font-size: 11px; color: var(--text-3); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port {
  position: absolute; width: 14px; height: 14px; border-radius: 50%; cursor: crosshair;
  border: 2.5px solid #fff; box-shadow: 0 0 0 1.5px var(--border-2); z-index: 2;
}
.port.in { left: -7px; }
.port.out { right: -7px; }
.port:hover, .port.dragging { transform: scale(1.25); box-shadow: 0 0 0 1.5px var(--primary), 0 0 8px rgba(108,92,231,.5); }
.node .del { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.25); color: #fff; display: none; place-items: center; font-size: 11px; }
.node:hover .del { display: grid; }
.node .del:hover { background: #EF4444; }

.editor-status { position: absolute; left: 14px; bottom: 14px; background: rgba(255,255,255,.95); border: 1px solid var(--border-2); border-radius: 12px; padding: 8px 14px; font-size: 12.5px; color: var(--text-2); box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; z-index: 5; }
.editor-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; }
.editor-status.running .dot { background: #F59E0B; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.minimap-hint { position: absolute; right: 14px; top: 14px; background: rgba(255,255,255,.9); border: 1px solid var(--border-2); border-radius: 999px; padding: 6px 13px; font-size: 12px; color: var(--text-3); z-index: 5; }

/* ============================================================
   弹窗 Modal
   ============================================================ */
.modal-mask { position: fixed; inset: 0; background: rgba(20,20,35,.45); z-index: 500; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .22s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: #F2F2F8; color: var(--text-2); font-size: 13px; transition: .15s; }
.modal-close:hover { background: #EF4444; color: #fff; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
