* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 220px 1fr 260px;
  height: 100vh;
  overflow: hidden;
  background: #2b2b2b;
  color: #ddd;
}

/* 顶栏 CommandManager */
#command-manager {
  grid-row: 1;
  grid-column: 1 / -1;
  background: #3c3c3c;
  border-bottom: 1px solid #1a1a1a;
  padding: 4px 8px;
}
#command-manager .tabs { display: flex; gap: 2px; margin-bottom: 4px; }
#command-manager .tab {
  padding: 4px 14px;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  font-size: 13px;
}
#command-manager .tab.active { background: #4a7fb5; color: #fff; }
#command-manager .groups { display: flex; gap: 12px; }
#command-manager .group {
  border-left: 1px solid #555;
  padding-left: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
#command-manager .group-label {
  font-size: 10px;
  color: #999;
  width: 100%;
}
#command-manager .cmd {
  padding: 6px 10px;
  background: #505050;
  border: 1px solid #666;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
#command-manager .cmd:hover { background: #5a8fcf; }
#command-manager .cmd.disabled { opacity: 0.35; pointer-events: none; }

/* 左侧 FeatureManager */
#feature-manager {
  grid-row: 2;
  grid-column: 1;
  background: #333;
  border-right: 1px solid #1a1a1a;
  padding: 8px;
  overflow-y: auto;
}
#feature-manager h3 { font-size: 12px; color: #888; margin-bottom: 6px; }
#feature-manager .tree-node { padding: 3px 6px; font-size: 13px; cursor: pointer; }
#feature-manager .tree-node:hover { background: #444; }

/* 中央图形区 */
#graphics-area {
  grid-row: 2;
  grid-column: 2;
  background: #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #555;
  position: relative;
}
#graphics-area .hint { position: absolute; bottom: 12px; font-size: 12px; color: #666; }

/* 右侧 PropertyManager */
#property-manager {
  grid-row: 2;
  grid-column: 3;
  background: #333;
  border-left: 1px solid #1a1a1a;
  padding: 8px;
  overflow-y: auto;
}
#property-manager h3 { font-size: 12px; color: #888; margin-bottom: 6px; }
#property-manager .prop-field { margin-bottom: 8px; }
#property-manager label { font-size: 11px; color: #aaa; display: block; margin-bottom: 2px; }
#property-manager input {
  width: 100%;
  padding: 4px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #ddd;
  border-radius: 2px;
}
#property-manager textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 4px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #ddd;
  border-radius: 2px;
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
}

/* 底部状态栏 */
#status-bar {
  grid-row: 3;
  grid-column: 1 / -1;
  background: #0078d4;
  color: #fff;
  padding: 3px 12px;
  font-size: 12px;
  display: flex;
  gap: 20px;
}

/* ===== 流程画布（FlowCanvas）===== */
#graphics-area {
  display: block;
  padding: 0;
  overflow: auto;
  background: #1e1e1e;
  color: #ddd;
  font-size: 13px;
}
.fc-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #2f2f2f;
  border-bottom: 1px solid #1a1a1a;
}
.fc-toolbar strong { font-size: 13px; color: #eee; }
.fc-toolbar button {
  padding: 4px 12px;
  background: #4a7fb5;
  border: none;
  border-radius: 3px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}
.fc-toolbar button:hover { background: #5a8fcf; }
.fc-toolbar button.edit-toggle {
  background: #4d4d4d;
  border: 1px solid #666;
  color: #ccc;
}
.fc-toolbar button.edit-toggle:hover { background: #5a5a5a; }
.fc-toolbar button.edit-toggle.active {
  background: #2e7d4f;
  border-color: #3f9c66;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(63, 156, 102, .3);
}
.fc-hint { font-size: 11px; color: #777; margin-left: auto; }

.fc-area { position: relative; }

.fnode {
  position: absolute;
  background: #333;
  border: 1px solid #555;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  font-size: 12px;
  user-select: none;
}
.fnode.selected { border-color: #5a9fd4; box-shadow: 0 0 0 2px rgba(90,159,212,.35); }
.fnode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #3f3f3f;
  border-radius: 5px 5px 0 0;
  cursor: move;
}
.fnode-title { font-weight: 600; color: #eee; }
.fnode-del { color: #999; cursor: pointer; padding: 0 4px; }
.fnode-del:hover { color: #e66; }

.fnode-io { display: flex; justify-content: space-between; padding: 6px 4px; }
.fnode-ins, .fnode-outs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fnode-outs { align-items: flex-end; }

/* 输入口块：端口行 + 手工输入框 */
.fnode-in { display: flex; flex-direction: column; gap: 3px; margin-bottom: 3px; }
.port-input {
  width: 100%;
  box-sizing: border-box;
  padding: 3px 5px;
  background: #262626;
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  color: #eee;
  font-size: 11px;
  font-family: 'Consolas', 'Menlo', monospace;
}
.port-input:focus { outline: none; border-color: #5a9fd4; box-shadow: 0 0 0 1px rgba(90,159,212,.4); }
.port-input:disabled { background: #2e2e2e; color: #777; border-style: dashed; cursor: not-allowed; }
.port-input::placeholder { color: #666; }
.port {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #bbb;
  cursor: crosshair;
  padding: 1px 2px;
  border-radius: 3px;
}
.port:hover { background: #444; }
.port i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #5a9fd4;
  border: 1px solid #7db8e8;
  display: inline-block;
  flex: none;
}
.port.pending i { background: #ffb347; border-color: #ffd28a; }
.port.out i { margin-left: 2px; }
.port.in i { margin-right: 2px; }

.fnode-acts { display: flex; gap: 4px; padding: 4px 6px; }
.fnode-acts button {
  flex: 1;
  padding: 3px 6px;
  background: #4a7fb5;
  border: none;
  border-radius: 3px;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
}
.fnode-acts button:hover { background: #5a8fcf; }

.fnode-status { padding: 3px 8px; font-size: 11px; color: #aaa; border-top: 1px solid #3a3a3a; }
.fnode-status.running { color: #ffb347; }
.fnode-status.done { color: #6c6; }
.fnode-status.error { color: #e66; }
.fnode-result {
  margin: 0 6px 6px;
  padding: 5px 6px;
  background: #262626;
  border-radius: 4px;
  font-size: 10px;
  color: #9bd;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 90px;
  overflow: auto;
}

/* ===== 登录门卫（未登录页）===== */
#login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #2f3b4a 0%, #1e2228 60%, #17191d 100%);
}
.login-card {
  width: 320px;
  padding: 28px 32px 22px;
  background: #2b2f36;
  border: 1px solid #444b55;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  text-align: center;
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  color: #eee;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.login-sub { font-size: 12px; color: #8a93a0; margin-bottom: 18px; }
.login-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  background: #22262c;
  border: 1px solid #4a525d;
  border-radius: 4px;
  color: #eee;
  font-size: 14px;
  text-align: center;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: #5a9fd4;
  box-shadow: 0 0 0 1px rgba(90, 159, 212, .4);
}
#auth-err {
  min-height: 18px;
  color: #e66;
  font-size: 12px;
  margin: 8px 0 2px;
}
.login-card button {
  width: 100%;
  padding: 9px;
  margin-top: 8px;
  background: #4a7fb5;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.login-card button:hover { background: #5a8fcf; }
.login-card button:disabled { opacity: .6; cursor: wait; }
.login-foot { margin-top: 16px; font-size: 11px; color: #5a6370; }
