/* 可复用 UI：浮动窗（可拖/可缩放/无遮罩不锁焦点）+ 分割条 + 下拉 */

.ui-win {
  position: fixed;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: #1a222c;
  color: #e8eef4;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  overflow: hidden;
  min-width: 280px;
  min-height: 140px;
  pointer-events: auto;
}
.ui-win.wide { /* 尺寸由 JS 设定 */ }

.ui-win-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 6px 14px;
  background: transparent;
  border-bottom: none;
  cursor: move;
  user-select: none;
}
.ui-win-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-win-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a8b4c0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.ui-win-close:hover {
  background: #b84a2a;
  color: #fff;
}

.ui-win-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px 12px;
  font-size: 13px;
  line-height: 1.45;
}
.ui-win-body > p {
  margin: 0 0 8px;
  color: #a8b4c0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ui-win-body input[type="text"],
.ui-win-body input[type="number"],
.ui-win-body input[type="password"],
.ui-win-body textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 7px 10px;
  border-radius: 6px;
  border: 0;
  background: #121820;
  color: #e8eef4;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.ui-win-body textarea {
  min-height: 160px;
  resize: none;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ui-win-body input[type="text"]:focus,
.ui-win-body input[type="number"]:focus,
.ui-win-body input[type="password"]:focus,
.ui-win-body textarea:focus {
  background: #0e141b;
  box-shadow: inset 0 0 0 1px #5b9fd4;
}

/* 配置行：说明 + 输入同一行 */
.ui-win-body .cfg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  min-width: 0;
}
.ui-win-body .cfg-row label {
  flex: 0 0 auto;
  min-width: 4.5em;
  margin: 0;
  font-size: 12px;
  color: #a8b4c0;
  white-space: nowrap;
  text-align: right;
}
.ui-win-body .cfg-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
}
.ui-win-body .cfg-sec {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.ui-win-body .cfg-sec:last-child { margin-bottom: 0; }
.ui-win-body .cfg-sec-title {
  margin: 4px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #8b98a8;
  white-space: nowrap;
}

.ui-win-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px 12px;
  border-top: none;
  background: transparent;
}
.ui-win-actions button {
  border: 0;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  color: #e8eef4;
}
.ui-win-actions button.primary { background: #2f6fed; color: #fff; }
.ui-win-actions button.danger { background: #b84a2a; color: #fff; }
.ui-win-actions button.ghost {
  background: transparent;
  color: #a8b4c0;
}

/* 缩放手柄 */
.ui-win-resize {
  position: absolute;
  z-index: 3;
}
.ui-win-resize-n { top: 0; left: 8px; right: 8px; height: 5px; cursor: n-resize; }
.ui-win-resize-s { bottom: 0; left: 8px; right: 8px; height: 5px; cursor: s-resize; }
.ui-win-resize-e { top: 8px; right: 0; bottom: 8px; width: 5px; cursor: e-resize; }
.ui-win-resize-w { top: 8px; left: 0; bottom: 8px; width: 5px; cursor: w-resize; }
.ui-win-resize-ne { top: 0; right: 0; width: 10px; height: 10px; cursor: ne-resize; }
.ui-win-resize-nw { top: 0; left: 0; width: 10px; height: 10px; cursor: nw-resize; }
.ui-win-resize-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; }
.ui-win-resize-sw { bottom: 0; left: 0; width: 10px; height: 10px; cursor: sw-resize; }

body.ui-win-dragging, body.ui-win-dragging * { cursor: moving !important; user-select: none !important; }
body.ui-win-resizing, body.ui-win-resizing * { user-select: none !important; }

/* 兼容旧类名（若有残留引用） */
.ui-modal-mask { display: none !important; }

.ui-gutter {
  position: relative;
  z-index: 5;
  background: transparent;
  flex: 0 0 var(--ui-gutter, 6px);
}
.ui-gutter::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.ui-gutter:hover, .ui-gutter.dragging { background: rgba(255,255,255,0.02); }
.ui-gutter:hover::after, .ui-gutter.dragging::after {
  opacity: 1;
  background: #5a6a76;
}
.ui-gutter-col { cursor: col-resize; }
.ui-gutter-col::after {
  left: 50%; width: 2px; margin-left: -1px; top: 8%; bottom: 8%;
}
.ui-gutter-row { cursor: row-resize; }
.ui-gutter-row::after {
  top: 50%; height: 2px; margin-top: -1px; left: 8%; right: 8%;
}
body.ui-resizing-col, body.ui-resizing-col * { cursor: col-resize !important; user-select: none !important; }
body.ui-resizing-row, body.ui-resizing-row * { cursor: row-resize !important; user-select: none !important; }

.ui-dropdown-panel {
  position: fixed;
  z-index: 4000;
  min-width: 140px;
  background: #1a222c;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
  padding: 4px;
  overflow: hidden;
  display: none;
}
.ui-dropdown-panel.open { display: block; }
.ui-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8eef4;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.ui-dropdown-item:hover { background: rgba(47, 111, 237, 0.22); }
.ui-dropdown-item:disabled { opacity: 0.4; cursor: not-allowed; }
.ui-dropdown-item.danger { color: #e07060; }
.ui-dropdown-item.danger:hover { background: rgba(184, 74, 42, 0.25); }
.ui-context-menu { min-width: 148px; }
.ui-context-sep {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255,255,255,0.1);
}
