.formula-editor-container {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;

  &:focus-within {
    border-color: #4161fd;
    box-shadow: 0 0 0 2px rgba(65, 97, 253, 0.1);
  }

  &.formula-editor-error {
    border-color: #f5222d;

    &:focus-within {
      box-shadow: 0 0 0 2px rgba(245, 34, 45, 0.1);
    }
  }

  .cm-editor {
    background: #fff;
  }

  .cm-focused {
    outline: none !important;
  }
}

.formula-field-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 22px;
  background: #e6f4ff;
  border: 1px solid #91caff;
  border-radius: 4px;
  color: #1677ff;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  cursor: default;
  user-select: none;
  vertical-align: middle;
  margin: 0 2px;
  line-height: 20px;
}

.cm-tooltip-autocomplete {
  border: 1px solid #e8e8e8 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  background: #fff !important;
  overflow: hidden;

  ul {
    max-height: 200px;
    overflow-y: auto;

    li {
      padding: 6px 12px !important;
      font-size: 13px;

      &[aria-selected='true'] {
        background: #f0f5ff !important;
        color: #1677ff;
      }
    }
  }
}

.cm-completionLabel {
  color: #333;
  font-weight: 500;
}

.cm-completionDetail {
  margin-left: 8px;
  color: #999;
  font-style: normal !important;
}

.cm-completionIcon-variable::after {
  content: 'F';
  color: #1677ff;
  font-weight: 600;
  font-size: 11px;
}

.cm-completionIcon-function::after {
  content: 'ƒ';
  color: #722ed1;
  font-weight: 600;
  font-size: 12px;
}
